我一直在寻找答案,但没有一个是 Storyboard。
我用过this用于创建我的 Split View的教程,它可以工作,但是以下部分:
UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
UINavigationController *navigationController = [splitViewController.viewControllers lastObject];
splitViewController.delegate = (id)navigationController.topViewController;
当然不会工作,因为 splitview 在 tabview 中。
如何将我的 DetailViewController 设置为委托(delegate)?
最佳答案
问题是因为我将 SplitViewController 设置为委托(delegate)中的 Root View 。
我将其更改为:
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UISplitViewController *splitViewController = [tabBarController.viewControllers lastObject];//(UISplitViewController *)self.window.rootViewController;
UINavigationController *navigationController = [splitViewController.viewControllers lastObject];
splitViewController.delegate = (id)navigationController.topViewController;
而且效果很好。
它也得到了苹果的认可。
关于ios - 如何在带有 Storyboard 的 UITabBarController 中实现 UISplitview?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14226334/