I have a table view in which each cell I have added a object. Now in cellForRowAtIndexPath I want to do some GUI action based on object included. For ex.
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
// Got object.
modal_info *obj = [self.listData objectAtIndex: [indexPath row]];
if (obj->status != OFI_VC_USER_STATE_HEADING)
{
cell.textLabel.text = obj->combined_name;
cell.detailTextLabel.text = obj->email;
// Set Image
UIImage *cellImage = [UIImage imageNamed:@"silhouette_user.png"];
cell.imageView.image = cellImage;
} else {
cell.imageView.image = nil;
cell.detailTextLabel.text = nil;
cell.textLabel.text = nil;
}
return cell;
But in tabular view name and image is showing for header row even though I am setting nil. Am I doing anything wrong?
thanks in advance.
@neon samuel I have fixed it. Its my mistake I have not set value properly while adding. Thanks anyway. 🙂 – Feroz Mohideen