Request for member 'row' in something not a structure or union
this is my first time here!
I'm getting that error when configuring an UITableViewCell.
This is my Cell:
@interface CellView : UITableViewCell {
IBOutlet UILabel *nombre;
IBOutlet UILabel *estado;
}
-(void)setName:(NSString *) name;
And this is the method that executes for every row:
-(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;
}
latitudes is a NSMutableArray
I've tried also with cell.nombre.text=[latitudes objetcAtIndex:indexP开发者_StackOverflow中文版ath.row]; but still returns the same error.
Any idea?
Thank you!
Your method signature seems to be wrong:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSInteger *)indexPath
It should be (note the type of the indexPath
parameter):
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
精彩评论