//viewdidload or similar
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleUpdateRequest:) name:@”myObject” object:nil];
////////////////////////////////////////////////////
////////// FROM A BUTTON
//button action or similar
-(IBAction)doSomething:(id)sender {
[[NSNotificationCenter defaultCenter] postNotificationName:@”myObject” object:sender];
}
//handler
-(void)handleUpdateRequest:(NSNotification *)notif {
NSLog(@”>>>%i”,[notif.object tag]);
}
OR
////////////////////////////////////////////////////
////////// TABLE CELL
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSNumber *indexPath_row = [[NSNumber alloc] initWithInt:indexPath.row];
[[NSNotificationCenter defaultCenter] postNotificationName:@”myObject” object:indexPath_row];
}
//handler
-(void)handleUpdateRequest:(NSNotification *)notif {
NSLog(@”>>>%i”,[notif.object intValue]);
}