Call method from initialized UIViewController in storyboarding - objective c

前端 未结 2 2070
旧巷少年郎
旧巷少年郎 2021-01-29 06:17

I\'m new to Storyboarding in objective c and I need to call method from UIVIewController. Before Storyboarding I was initializing UI

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-29 07:01

    You can get the root view controller of your storyboard from your app delegate. For example:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        UITabbarController *tbc = (UITabbarController *)self.window.rootViewController;
    
        // Do any setup you want to here
        // You aren't setting up the controller - just accessing the one that has been set up for you by the storyboard
    
        return YES;
    }
    

提交回复
热议问题