Created
October 3, 2012 07:03
-
-
Save ryanhanwu/3825488 to your computer and use it in GitHub Desktop.
Nib Way pass value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction)passValueButton:(id)sender { //An action method | |
{ | |
User *user = [[User alloc] init]; | |
user.name = "Ryan"; | |
user.age = "26"; | |
//get the instance of ViewController2 | |
ViewController2 *viewCtrl2 = [[SecondViewController alloc] | |
initWithNibName:@"ViewController2" bundle:[NSBundle mainBundle]]; | |
viewCtrl2.user = user; | |
[self presentModalViewController:viewCtrl2 animated:YES];//Go to view 2 | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
NSLog(@"Name : %@", self.user.name); | |
NSLog(@"Age : %@", self.user.age); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment