ReceiverViewController.h
@property (nonatomic, assign) NSInteger currrentIndex;
ReceiverViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSLog(@"Index value %d",self.currrentIndex);
}
DataPassingViewController.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
DataPassingViewController *detailViewController = [[DataPassingViewController alloc] initWithNibName:@"DataPassingViewController" bundle:nil];
detailViewController.currrentIndex = 5;
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
}
I used the above code which gives a output as follows:
2013-07-10 17:50:10.230 DataPassing[3881:c07] Index value 5