Reputation: 53
I'm now writing a registration screen before my tabBar shows up. My idea is to show my registration screen through this method (no dismiss function for now):
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
Register *registerView = [[Register alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:registerView animated:YES];
return YES;
}
Which is in AppDelegate.m
Unfortunately it doesn't work. Could you help me solve this please?
Upvotes: 2
Views: 8479
Reputation: 135588
presentModalViewController:animated:
is a method of the UIViewController
class. Since the app delegate is not a view controller, you can't send it this method. To display your first view controller on screen, assign it to your app's main window's rootViewController
property:
self.window.rootViewController = registerView;
Upvotes: 3