更新时间:2023-02-02 15:21:33
您可以尝试通过rootviewcontroller将控制器(NavigationController)插入窗口。
You can try insert your controller(NavigationController) to window by rootviewcontroller.
如果不适合您,请使用通知UIApplicationWillChangeStatusBarOrientationNotification
if not works for you, use notifications UIApplicationWillChangeStatusBarOrientationNotification
编辑
Works:
// custom controller
TestController *t = [[TestController alloc] init];
// navigaton
UINavigationController *controllerinsertIntoTab = [[UINavigationController alloc] initWithRootViewController:t];
// tab bar
UITabBarController *tabbarController = [[UITabBarController alloc] init];
[tabbarController addChildViewController:controllerinsertIntoTab];
// first navigation
UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:tabbarController];
[self.window setRootViewController:controller];
特别为你 https://github.com/sakrist/TestControllers
我希望它有用