【问题标题】:iOS - How do I pass arguments from didFinishLaunchingWithOptions to a viewController?iOS - 如何将参数从 didFinishLaunchingWithOptions 传递给 viewController?
【发布时间】:2011-08-11 14:10:09
【问题描述】:

我想知道如何将代理 didFinishLaunchingWithOptions 的参数传递给第一个将启动其视图的视图控制器。

我在网上没有找到类似的东西。

提前谢谢你!

【问题讨论】:

    标签: ios delegates uiviewcontroller


    【解决方案1】:

    试试这个:

    myViewController = [[MyViewController alloc] init];
    [myViewController setMyCoolFirstArgument: coolArgument];
    [myViewController setMyCoolSecondArgument: coolSecondArgument];
    [window setRootViewController: myViewController];
    

    MyViewController.h

    @property (nonatomic, retain) CoolArgument *myCoolFirstArgument;
    @property (nonatomic, retain) CoolArgument *myCoolSecondArgument;
    

    MyViewController.m

    @synthesize myCoolFirstArgument, myCoolSecondArgument;
    

    【讨论】:

      猜你喜欢
      • 2023-01-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多