开发者

Load an other View from applicationDidFinishLaunching in the AppDelegate

I have this code in my applicationDidFinishLaunching in the AppDelegate:

- (void)applicationDidFinishLaunching:(UIApplication *)application {
 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
    NSString *firsttime = [defaults stringForKey:@"firsttime"];
    if (firsttime == nil) {

        BenutzerdatenViewController *Benutze开发者_开发知识库r = [[BenutzerdatenViewController alloc] initWithNibName:nil bundle:nil];
        Benutzer.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [Benutzer release];

        [defaults setObject:@"lasttime" forKey:@"firsttime"];}
    else {  [window addSubview:viewController.view];
        [window makeKeyAndVisible];}

Always when I open the app the first time I just see a with "view" instead of the right view with buttons and so on. Where is the problem?


You need to add the actual view to your window. For firsttime, you need the following:

[window addSubview: Benutzer.view];

Also, don't release that viewController; you should store a reference to it somewhere.

In the other case (!firstime), it's unclear where you're getting viewController from; I assume it's a member variable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜