4
我想从xib显示模态对话框。显示我的窗口中的代码是:从Xib呈现模态视图控制器
self.vcSettings = [[ViewControllerSettings alloc] initWithNibName:@"ViewControllerSettings" bundle:[NSBundle mainBundle]];
[self presentModalViewController:self.vcSettings animated:YES];
在运行此虽然,我得到了一个空白页面,并没有什么是我ViewControllerSettings.xib内。我想我以某种方式错误地显示了视图。任何建议表示赞赏。
编辑:
我想这应该是
[self.navigationController presentModalViewController:self.vcSettings animated:YES];
但由于某种原因self.navigationController
为零。
编辑:
自我是在我的AppDelegate实例,像这样一个UIViewController:
UIViewController* viewMain = [[ViewController_iPhone alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
self.window.rootViewController = viewMain;
[self.window makeKeyAndVisible];
如何将方法切换为 [self presentViewController:self.vcSettings animated:YES completion:^ {{{“%@”,self.presentedViewController); }]; 什么打印在控制台上? self.presentedViewController对象是否为零? –
确保viewcontroller的'view'插座连接到其xib中的根视图。 –
@Vladim,谢谢,视图连接在根视图xib – dev