Passing values between two UIViewControllers

Hi,Welcome again
There are some times requirement in iphone development i.e. How to pass values between two view controllers Here is the code in xcode

Root class code is here

@interface FirstRootViewController : UIViewController
{
}
@implementation FirstRootViewController
in Any button click event write the following code

SecoViewController *cn = [[SecoViewController alloc] initWithNibName:@"SecoViewController" bundle:nil];
cn.SecondControllerString = @"Your value";
[self.navigationController pushViewController:cn animated:YES];
 [cn release];

@end

@implementation SecoViewController
-(void)viewDidLoad
{
          NSLog("%@", SecondControllerString);
}
@end

0 comments:

Post a Comment

Powered by Blogger.
Twitter Delicious Facebook Digg Stumbleupon Favorites More