 <p>Put the complete code in brackets : </p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"; NSArray *listData =[self-&gt;tableContents objectForKey: [self-&gt;sortedKeys objectAtIndex:[indexPath section]]]; UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier]; if(cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier]; NSUInteger row = [indexPath row]; textClass *myText = (textClass*)[listData objectAtIndex:row]; cell.textLabel.text = myText.text; UIImageView *unchecked = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"unchecked.png"]]; UIImageView *checked = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checked.png"]]; cell.accessoryView = (myText.isChecked ? checked : unchecked); } return cell; } </code></pre> <p>This should definitely work.</p>