要显示SplitViewController,您需要使用setRootViewController。这是因为SplitViewController需要成为根视图控制器。
从苹果公司的文档:
A split view controller must always be the root of any interface you create. In other words, you must always install the view from a UISplitViewController object as the root view of your application's window. The panes of your split-view interface may then contain navigation controllers, tab bar controllers, or any other type of view controller you need to implement your interface.
要回到你需要使用setRootViewController回到前面的页面。当我将iPhone应用程序转换为通用程序时,遇到了这个问题,并最终使用iPhone的导航控制器和iPad版本的setRootViewController。这是一个有点无赖,因为你不能很好地动画without a bit of fudging。
我该如何使用setRootViewController?谷歌告诉我这是一个UIWindow的方法,但我无法弄清楚在哪里找到一个UIWindow实例。 – 2012-04-05 16:29:41
您需要从应用程序委托中获取属性,如下所示:MyAppDelegate * appDelegate =(MyAppDelegate *)[[UIApplication sharedApplication] delegate];然后[appDelegate.window setRootViewController:shareSelectViewController]; – glenstorey 2012-04-05 19:58:11
非常感谢你! – 2013-04-22 22:44:07