解决方案 »

  1.   

    苹果本身就不允许你将uisplitviewcontroller去push到uinavigationcontroller 中。
    参考:http://stackoverflow.com/questions/6855454/how-can-we-push-uisplitviewcontroller-to-a-uinavigationcontroller
      

  2.   

    我通过Storyboard可以做到。只是不明白为什么不能通过程序实现。
      

  3.   

    Storyboard 拖拽一个UINavigationController 作为起点,设置它的RootViewController为自己的PHMessagingSplitViewController就可以了。
      

  4.   


    在AppDelegate.h中, 将uisplitviewcontroller作为uiwindow的rootviewcontroller .如下:
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        self.window.backgroundColor = [UIColor whiteColor];
        
    //PHMessagingSplitViewController is a subclass of UISplitViewController
        PHMessagingSplitViewController *tmpVC = [[PHMessagingSplitViewController alloc] init];    self.window.rootViewController =tempVC;
        [self.window makeKeyAndVisible];
        
        return YES;
    }
      

  5.   


    在AppDelegate.h中, 将uisplitviewcontroller作为uiwindow的rootviewcontroller .如下:
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        self.window.backgroundColor = [UIColor whiteColor];
        
    //PHMessagingSplitViewController is a subclass of UISplitViewController
        PHMessagingSplitViewController *tmpVC = [[PHMessagingSplitViewController alloc] init];    self.window.rootViewController =tempVC;
        [self.window makeKeyAndVisible];
        
        return YES;
    }谢谢你的回复。不过我需要在最顶部显示NavigationBar。所以必须要用UINavigationController.
      

  6.   


    在AppDelegate.h中, 将uisplitviewcontroller作为uiwindow的rootviewcontroller .如下:
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        self.window.backgroundColor = [UIColor whiteColor];
        
    //PHMessagingSplitViewController is a subclass of UISplitViewController
        PHMessagingSplitViewController *tmpVC = [[PHMessagingSplitViewController alloc] init];    self.window.rootViewController =tempVC;
        [self.window makeKeyAndVisible];
        
        return YES;
    }谢谢你的回复。不过我需要在最顶部显示NavigationBar。所以必须要用UINavigationController.UISplitViewController 应该也是一个容器controller,左边的是Master, 右边的是Deitail. 指定Master和Detail 对应的控制器均为UINavigationController 不就可以了吗 ?
      

  7.   


    在AppDelegate.h中, 将uisplitviewcontroller作为uiwindow的rootviewcontroller .如下:
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        self.window.backgroundColor = [UIColor whiteColor];
        
    //PHMessagingSplitViewController is a subclass of UISplitViewController
        PHMessagingSplitViewController *tmpVC = [[PHMessagingSplitViewController alloc] init];    self.window.rootViewController =tempVC;
        [self.window makeKeyAndVisible];
        
        return YES;
    }谢谢你的回复。不过我需要在最顶部显示NavigationBar。所以必须要用UINavigationController.UISplitViewController 应该也是一个容器controller,左边的是Master, 右边的是Deitail. 指定Master和Detail 对应的控制器均为UINavigationController 不就可以了吗 ?最顶部显示,在Master Detail里面我不需要显示各自NavigationBar的。
      

  8.   

    不过我已经用Storyboard实现了。只是不知道为什么Storyboad可以做,而程序中不可以。