1
我已经创建了一个视图控制器通过新文件,我检查了创建笔尖选项,并没有问题。我做了一个很好的IB布局,事情很好。文件所有者被链接到正确的ViewController,nib中的视图链接到文件所有者的视图插座。试图用.nib加载视图控制器失败
现在,我尝试在AppDelegate中用nib实例化这个视图控制器。
TerminationViewController *terminatedVC = [[TerminationViewController alloc] initWithNibName:@"TerminationViewController" bundle:nil];
terminatedVC.view.hidden = NO;
[self.window.rootViewController presentViewController:terminatedVC animated:YES completion:nil];
有没有错误,我看到一个黑屏。我究竟做错了什么?我也检查了笔尖的目标成员。
编辑
self.window = [[[InterceptorWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.window.backgroundColor = [UIColor whiteColor];
TerminationViewController *terminatedVC = [[TerminationViewController alloc] initWithNibName:@"TerminationViewController" bundle:nil];
terminatedVC.view.hidden = NO;
[self.window.rootViewController presentViewController:terminatedVC animated:YES completion:nil];
// Wait for 10 seconds
double delayInSeconds = 10.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void) {
// Do something, next view controller.
}
你可以发布在applicationDidFinishLaunching中调用的整个代码吗? – user3797599
我已经这么做:) – jbehrens94
我没有看到任何地方[self.window makeKeyAndVisible]; – user3797599