Reputation: 2406
I have created a view controller via new file, I checked the create nib option and that went okay. I made a nice IB layout and things are great. The file owner is linked to the right ViewController, the view in the nib is linked to the view outlet in the file owner.
Now, I try to instantiate this view controller with the nib in AppDelegate.
TerminationViewController *terminatedVC = [[TerminationViewController alloc] initWithNibName:@"TerminationViewController" bundle:nil];
terminatedVC.view.hidden = NO;
[self.window.rootViewController presentViewController:terminatedVC animated:YES completion:nil];
There are no errors and I see a black screen. What am I doing wrong? I also checked the target membership for the nib.
Edit
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.
}
Upvotes: 1
Views: 69
Reputation: 910
Call [self.window makeKeyAndVisible]; in applicationDidFinishLaunching
Upvotes: 2