-(IBAction)btn:(id)sender {
abcViewController *vc = [[abcViewController alloc]initWithNibName:@"abcViewController" bundle:nil];
vc.str = @"hello";
[self.navigationController pushViewController:vc animated:YES];
}
Asked
Active
Viewed 428 times
-2

Achrome
- 7,773
- 14
- 36
- 45

vadher yamraj
- 1
- 1
-
2possible duplicate of http://stackoverflow.com/questions/8429088/ios-storyboard-passing-data-navigationviewcontroller – Ashwin P Jun 17 '15 at 10:08
2 Answers
0
Check out this code
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"identifierName"];
vc.label = @"Text";
[self.navigationController pushViewController:vc animated:YES];

Rajesh Maurya
- 3,026
- 4
- 19
- 37
-
Does it solve your problem? If yes please make it accepted and click on up vote button. Thanks. – Rajesh Maurya Jun 17 '15 at 11:19
0
Suppose you want to send string value from one view to another using storyboard. In first view controller declare the variable in .h file like NSString str; and in second view controller declare the variable in .h like NSString newStr;. Then in first view controller of .m file create second view object using storyboard - SecondViewController *svc = [storyboard instantiateViewControllerWithIdentifier:@"SecondViewController"]; And send variable using this object to second view- svc.newStr = str;

Avinash Tribhuvan
- 194
- 1
- 8