0

将 spliviewController 添加为 rootviewcontroller 后,我需要提供一个登录 Viewcontroller

MasterVC *masterViewController = [[[MasterVC alloc] initWithNibName:@"MasterVC" bundle:nil] autorelease];
UINavigationController *masterNavigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease] ;
masterNavigationController.navigationBar.barStyle=UIBarStyleBlackOpaque;
masterNavigationController.delegate=masterViewController;

Home *detailViewController = [[[Home alloc] initWithNibName:@"home" bundle:nil] autorelease];
UINavigationController *detailNavigationController = [[[UINavigationController alloc] initWithRootViewController:detailViewController] autorelease];
detailNavigationController.navigationBar.barStyle=UIBarStyleBlackOpaque;

self.splitViewController = [[[UISplitViewController alloc] init] autorelease];
self.splitViewController.viewControllers = [NSArray arrayWithObjects:masterNavigationController, detailNavigationController, nil];


 self.window.rootViewController=self.splitViewController;
    LoginVC *modalLoginView = [[[LoginVC alloc] initWithNibName:@"LoginVC" bundle:nil] autorelease];
[modalLoginView setModalPresentationStyle:UIModalPresentationFullScreen];
[self.splitViewController presentModalViewController:modalLoginView animated:NO];

[self.window makeKeyAndVisible];
return YES;

但是没有显示登录视图。请帮助。在此先感谢

4

1 回答 1

0

尝试在主视图或详细视图的 viewDidAppear 事件中呈现模态视图。显然 appDelegate 尝试做 UI 演示的东西还为时过早,因为还没有界面。

您还需要将 splitViewController 的视图作为子视图添加到您的窗口中。

[self.window addSubView:self.spliViewController.view];
于 2013-04-08T18:09:40.403 回答