Saturday, June 8, 2013

UITableView tableView didDeselectRowAtIndexPath example in Objective C (iOS).


UITableView tableView didDeselectRowAtIndexPath

Tells the delegate that the specified row is now deselected.

- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath

Parameters of [UITableView tableView didDeselectRowAtIndexPath]
tableView
A table-view object informing the delegate about the row deselection.
indexPath
An index path locating the deselected row in tableView.

Discussion of [UITableView tableView didDeselectRowAtIndexPath]
The delegate handles row deselections in this method. It could, for example, remove the check-mark image (UITableViewCellAccessoryCheckmark) associated with the row.

UITableView tableView didDeselectRowAtIndexPath example.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    NSLog(@"%s", __PRETTY_FUNCTION__);
}

-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"%s", __PRETTY_FUNCTION__);
    [tableView reloadData];
}

-(NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"%s", __PRETTY_FUNCTION__);
    return indexPath;
}

Example of [UITableView tableView didDeselectRowAtIndexPath].
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
MyViewController *prof = [[MyViewController alloc]initWithNibName:@\"MyViewController\" bundle:nil];
prof.hidesBottomBarWhenPushed = YES;
[prof loadWebPage:[[[details objectForKey:@\"Place\"]objectAtIndex:indexPath.section]objectForKey:@\"map_url\" ]];

[self.navigationController pushViewController:prof animated:YES];
}

End of UITableView tableView didDeselectRowAtIndexPath example article.