Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Make a unchecked and checked image..</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } if ([selectedRowsArray containsObject:[contentArray objectAtIndex:indexPath.row]]) { cell.imageView.image = [UIImage imageNamed:@"checked.png"]; } else { cell.imageView.image = [UIImage imageNamed:@"unchecked.png"]; } UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleChecking:)]; [cell.imageView addGestureRecognizer:tap]; cell.imageView.userInteractionEnabled = YES; //added based on @John 's comment //[tap release]; cell.textLabel.text = [contentArray objectAtIndex:indexPath.row]; return cell; } - (void) handleChecking:(UITapGestureRecognizer *)tapRecognizer { CGPoint tapLocation = [tapRecognizer locationInView:self.tableView]; NSIndexPath *tappedIndexPath = [self.tableView indexPathForRowAtPoint:tapLocation]; if ([selectedRowsArray containsObject:[contentArray objectAtIndex:tappedIndexPath.row]]) { [selectedRowsArray removeObject:[contentArray objectAtIndex:tappedIndexPath.row]]; } else { [selectedRowsArray addObject:[contentArray objectAtIndex:tappedIndexPath.row]]; } [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:tappedIndexPath] withRowAnimation: UITableViewRowAnimationFade]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload