2011-06-10 78 views
0

這是我第一次來這裏!索取會員'row'的東西不是結構或聯盟

我在配置UITableViewCell時遇到了這個錯誤。

這是我的手機:

@interface CellView : UITableViewCell { 
    IBOutlet UILabel *nombre; 
    IBOutlet UILabel *estado; 
} 

-(void)setName:(NSString *) name; 

這是對每一行執行方法:

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSInteger *)indexPath { 
    static NSString *CellIdentifier = @"CellView"; 

    CellView *cell = (CellView *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if(cell==nil){ 
     NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CellView" owner:nil options:nil]; 
     for(id currentObject in topLevelObjects){ 
      if([currentObject isKindOfClass:[UITableViewCell class]]){ 
       cell = (CellView *) currentObject; 
       break; 
      } 
     } 
    } 
    [cell setName:[latitudes objectAtIndex:indexPath.row]]; 
    return cell;  
} 

緯度是NSMutableArray的

我與細胞也試過。 nombre.text = [緯度objetcAtIndex:indexPath.row];但仍然返回相同的錯誤。

有什麼想法?

謝謝!

回答

0

你的方法簽名似乎是錯誤的:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSInteger *)indexPath 

它應該是(注意indexPath參數的類型):

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
+0

哇!我覺得自己很愚蠢!非常感謝你! – Ibai 2011-06-10 18:59:00

+0

不客氣!如果您對此感到滿意,請考慮[接受答案](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work):) – albertamg 2011-06-10 19:01:42

+0

好的,完成了!那麼,這是我第一次構建TableView。現在我想知道爲什麼它不構建它...我必須隨時調用這個方法嗎?我正在申請:didFinnisLaunchingWithMethod中的NSMuteArray。在tableView:numberOfRowsInSection中添加了一個NSLog,但它永遠不會被調用! :S再次感謝! – Ibai 2011-06-10 19:03:36

相關問題