获取视图控制器window的三种方式

2016-07-30  本文已影响136人  学长的日常

第一种:

1 通过self.view获取window
        self.view.window.rootViewController = tabBarC;

第二种:

2 通过APPDelegate对象获取window
        AppDelegate *appdelegate =  [UIApplication sharedApplication].delegate;
        appdelegate.window.rootViewController = tabBarC;

第三种:

3 直接获取
        [UIApplication sharedApplication].keyWindow.rootViewController = tabBarC;
上一篇下一篇

猜你喜欢

热点阅读