jason
jason

Reputation: 259

passing variable between view controllers

i'm having a variable in NSInteger which i want to pass from FirstViewController to SecondViewController. In viewDidload of FirstViewController i have this

SecondViewController*detail = [self.storyboard instantiateViewControllerWithIdentifier:@"Second"];
    detail.integer2= self.integer1;
    NSLog(@"VARIABLE PASSED----%d",detail.integer2 );

NSLog is showing exactly what i want to pass. my question is how can i retrieve passed value in SecondViewController.

Upvotes: 1

Views: 200

Answers (2)

Mehul Mistri
Mehul Mistri

Reputation: 15147

Make Property of integer2 in SecondViewController and use as self.integer2 in SecondViewController

Upvotes: 2

ikuramedia
ikuramedia

Reputation: 6058

In your SecondViewController you can just call self.integer2

Upvotes: 3

Related Questions