iOS - How do I pass arguments from didFinishLaunchingWithOptions to a viewController?
I want to know how can I pass arguments 开发者_Python百科from the delegate didFinishLaunchingWithOptions to the first view controller whose view will be launched.
I didn`t find anything similar on the Internet.
Thank you in advance!
Try this:
myViewController = [[MyViewController alloc] init];
[myViewController setMyCoolFirstArgument: coolArgument];
[myViewController setMyCoolSecondArgument: coolSecondArgument];
[window setRootViewController: myViewController];
and in MyViewController.h
@property (nonatomic, retain) CoolArgument *myCoolFirstArgument;
@property (nonatomic, retain) CoolArgument *myCoolSecondArgument;
and in MyViewController.m
@synthesize myCoolFirstArgument, myCoolSecondArgument;
精彩评论