Iphone 当用户在基于视图的应用程序中启动UILocalNotification时,打开特定的视图控制器

Iphone 当用户在基于视图的应用程序中启动UILocalNotification时,打开特定的视图控制器,iphone,objective-c,uilocalnotification,Iphone,Objective C,Uilocalnotification,我正在使用UILocalNotification。在这里,当我启动通知时,我需要应用程序中的一个特定视图。但是我尝试了如下编码 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch.

我正在使用UILocalNotification。在这里,当我启动通知时,我需要应用程序中的一个特定视图。但是我尝试了如下编码

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after application launch.
     [[UIApplication sharedApplication]setStatusBarHidden:NO];

    SplashView *mySplash = [[SplashView alloc] initWithImage:
                            [UIImage imageNamed:@"Splash.png"]];

    [window insertSubview:mySplash atIndex:1];

    [window makeKeyAndVisible];


    mySplash.delay = 5;
    mySplash.animation = SplashViewAnimationFade;
    [mySplash startSplash];
        [self.window insertSubview:viewController.view atIndex:0];
        [self.window makeKeyAndVisible];
        [mySplash release];

    // Add the view controller's view to the window and display.    [self.window addSubview:viewController.view];

    UILocalNotification *localNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];

    if (localNotification) 
    {
        NSLog(@"Notification Body: %@",localNotification.alertBody);
        NSLog(@"%@", localNotification.userInfo);
    }
    [[UIApplication sharedApplication] cancelAllLocalNotifications];

    application.applicationIconBadgeNumber = 0;
    return YES;

}





- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {

UIApplicationState state = [application applicationState];
    if (state == UIApplicationStateInactive) {

showItemContrller = [[Showitem alloc] initWithNibName:@"Showitem" bundle:nil];
        [self.window addSubview:showItemContrller.view];
        [self.window bringSubviewToFront:showItemContrller.view];

}

}
但当我启动通知时,它会在几秒钟内显示上一个视图,并显示showItemControllerView


谢谢

Abishek您在收到本地通知后感到困惑,它将转到(无效)应用程序:(UIApplication*)应用程序确实收到了本地通知:(UILocalNotification*)通知,但它不会进入DidFinishWithLaunch方法。我想您没有理解我的意思。。。只需在默认控制器上添加默认图像。。。启动后,该控制器将显示,并且该控制器仅具有相同的默认图像,几秒钟后,您将进入原始屏幕..didReceiveLocalNotification:然后不要显示该行..No Abishek如何在默认控制器上添加默认图像在显示ShowItemController之前,请向我们显示它正在显示前一行应用状态。那么如何避免这种情况呢?
 //comment this line.... 

//[self.window insertSubview:viewController.view atIndex:0];