开发者

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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜