Ios 应用程序的单点和双点home按钮行为WillResignActive

Ios 应用程序的单点和双点home按钮行为WillResignActive,ios,objective-c,background,Ios,Objective C,Background,我正在做一个有一些合理数据的应用程序,因此如果用户在后台模式下进入,我需要隐藏预览屏幕,例如,如果用户双击home按钮,就会显示一个黑屏 我在应用程序willresignative方法中这样做,方法是在UIWindow上添加一个黑屏。在iOS8上,单点和双击home按钮都可以正常工作,但在iOS7上,当用户双击home按钮时,只会添加黑屏,而单点时则不会添加黑屏(显示的应用程序没有黑屏) 我刚刚意识到,如果用户单次点击home按钮,应用程序willresignative方法会在很久以后被调用,

我正在做一个有一些合理数据的应用程序,因此如果用户在后台模式下进入,我需要隐藏预览屏幕,例如,如果用户双击home按钮,就会显示一个黑屏

我在应用程序willresignative方法中这样做,方法是在UIWindow上添加一个黑屏。在iOS8上,单点和双击home按钮都可以正常工作,但在iOS7上,当用户双击home按钮时,只会添加黑屏,而单点时则不会添加黑屏(显示的应用程序没有黑屏)

我刚刚意识到,如果用户单次点击home按钮,应用程序willresignative方法会在很久以后被调用,但我不知道为什么它只在双击时添加黑屏。这是我在applicationWillResignActive上调用的方法

- (void)addSplashImage
{
    UIInterfaceOrientation interfaceOrientation = [UIApplication sharedApplication].statusBarOrientation;

    if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
        self.splashImageView = [[UIImageView alloc] initWithFrame:self.window.frame];

        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
            self.splashImageView.image = [UIImage imageNamed:@"Splash"];
        } else {
            self.splashImageView.image = [UIImage imageNamed:@"SplashiPhone"];
        }
    } else {
        CGRect frame = self.window.bounds;
        if ([TWConstants isRunningiOS8]) {
            self.splashImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
        } else {
            self.splashImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, frame.size.height, frame.size.width)];
        }
        self.splashImageView.image = [UIImage imageNamed:@"SplashLandscape"];
    }

    UIWindow *window = [UIApplication sharedApplication].keyWindow;
    [window addSubview:self.splashImageView];
   // [window bringSubviewToFront:self.splashImageView];
}
你知道为什么会这样吗?我尝试过将splash图像放在前面,但没有成功。只有在iOS7上才会发生这种情况。谢谢