how to select row and make it checked in tableview in iphone

Leave a Comment
Select any row from tableview and make it checked in iphone using programming. I already explain you to display records row by row in tableview(check it here). Now for selecting any row in tableview you have to write this code snippest

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UIAlertView *messageAlert = [[UIAlertView alloc]
                                 initWithTitle:@"Row is selected by Me" message:@"OK" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
 
    // Display Alert Message
    [messageAlert show];
 
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
 
     
}
Now to make selected row checked append this single line in didSelectRowAtIndexPath
cell.accessoryType = UITableViewCellAccessoryCheckmark;


If you like this post than please just leave comment and if you want to write post just give me mail on devang9978@gmail.com..

0 comments:

Post a Comment