[Solved] How to pass integer from MasterViewController to DetailViewController? [duplicate]


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    int num = indexPath.row;//cell.tag;
    DetailViewController *detailVC  = [[DetailViewController alloc] init];
    detailVC.number = num;
    [self.navigationController pushViewController:detailVC animated:YES];
}

DetailViewController.h

 @property (nonatomic, assign) int number;

DetailViewController.m

 @implementation DetailViewController
 @synthesize number;

 -(void)viewDidLoad:(BOOL)animated
 {
    [super viewDidLoad];         
    NSLog(@"Number:= %d",number);
 }

Hope this will help you!!

2

solved How to pass integer from MasterViewController to DetailViewController? [duplicate]