2013-02-18 47 views
0

我有一個NSDictionary有很多嵌套的數據。所有這些數據在我的UIViewController中加載一次,然後重新加載我的UITableView,使用此數據填充其單元格的標籤,這些標籤在單獨的xib中設置。所有的加載過程發生得非常快,但我的UITableView的滾動變得非常緩慢。我首先想到的可能是每次分配一個單元格時加載的xib,所以我測試了默認的UITableViewCell而不是加載它,但沒有任何更改。 這個問題是由我訪問我的數據的方式引起的嗎?我做了以下內容:由於NSDictionary嵌套數據,UITableView滾動緩慢?

NSDictionary *match = dictionaryMatches[@"dates"][indexPath.section][@"matches"][indexPath.row]; 

homeTeamAbbreviationLabel.text = match[@"home"]; 
visitorTeamAbbreviationLabel.text = match[@"visitor"]; 
matchTimeLabel.text = match[@"time"]; 
leagueLabel.text = match[@"league"]; 

homeNameLabel.text = match[@"home_name"]; 
visitorNameLabel.text = match[@"visitor_name"]; 

而且這一代碼進入內部- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

任何建議也將不勝感激。

回答

0

我剛剛發現問題是什麼。我在我的xib中設置了單元標識符,但未在我的代碼中使用它。

之前,我固定的問題是:

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[NSString stringWithFormat:@"cell"]]; 

現在是:

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[NSString stringWithFormat:@"RegularMatchCell"]]; 

現在它工作正常。