I add imageView to the main application window in applicationDidEnterBackground:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
UIImageView *splash = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"splashimage.png"]];
splash.frame = self.window.bounds;
[self.window addSubview:splash];
}
I expect that when I put the application in the background by pressing the home button of the device, then viewing the task manager, double-clicking the home button, I will see how splashimage.png is displayed. But it seems that the screenshot that is taken when the application goes into the background does not include this overlay image. I thought it would be, since I added a View image without animation.
Why can this happen?
UPDATE: even if I hide my window in applicationDidEnterBackground, I still see a full window, not closed, in the task manager after the application is placed in the background. The window becomes hidden some time after the application returns from the background when I press the home button.
- (void)applicationDidEnterBackground:(UIApplication *)application
{
self.window.hidden = YES;
}
UPDATE: I understand, by the way, that applicationDidEnterBackground has 5 seconds to complete. Now I am only testing this with
self.window.hidden = YES;
in applicationDidEnterBackground and nothing in applicationWillResignActive, and the window is still not hidden when the application goes into the background; only when he comes back to the fore. So this tells me that there must be something else, somewhere in my application, which prevents this from happening in applicationDidEnterBackground. By the way, if I moved
self.window.hidden = YES;
applicationWillResignActive, , . , , , applicationDidEnterBackground. .
UPDATE: BannerViewController (iAd). UITabBarController. , , UITabBarController.
: , UITabBarController, BannerViewController (iAd). , , ...
UPDATE: BannerViewController.m :
[self.view addSubview:bannerView]
:
- (void)viewDidLayoutSubviews
{
CGRect contentFrame = self.view.bounds, bannerFrame = CGRectZero;
ADBannerView *bannerView = [BannerViewManager sharedInstance].bannerView;
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0
NSString *contentSizeIdentifier;
if (contentFrame.size.width < contentFrame.size.height) {
contentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
} else {
contentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
}
bannerFrame.size = [ADBannerView sizeFromBannerContentSizeIdentifier:contentSizeIdentifier];
#else
bannerFrame.size = [_bannerView sizeThatFits:contentFrame.size];
#endif
if (bannerView.bannerLoaded) {
contentFrame.size.height -= bannerFrame.size.height;
bannerFrame.origin.y = contentFrame.size.height;
} else {
bannerFrame.origin.y = contentFrame.size.height;
}
_contentController.view.frame = contentFrame;
if (self.isViewLoaded && (self.view.window != nil)) {
[self.view addSubview:bannerView];
bannerView.frame = bannerFrame;
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0
bannerView.currentContentSizeIdentifier = contentSizeIdentifier;
#endif
}
}
, , - , , BannerViewController.
UPDATE: , (bannerVC - BannerViewController).
- (void)applicationWillResignActive:(UIApplication *)application {
[bannerVC.view snapshotViewAfterScreenUpdates:YES];
}
UPDATE: , applicationDidEnterBackground. , , AdBannerView , . , , applicationWillResignActive - , , "" . , AdBannerView, applicationDidEnterBackground, .
UPDATE:
:
- iAdSuite
- TabbedBanner.
- AppDelegate:
- . ( , , )
- "" , .
- "", .
applicationWillResignActive applicationDidEnterBackground , - . applicationDidEnterBackground applicationWillResignActive, . . , applicationDidEnterBackground.
- (void)applicationWillResignActive:(UIApplication *)application {
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
[self addDummyView];
[_tabBarController.view snapshotViewAfterScreenUpdates:YES];
}
- (void)addDummyView {
UIView *topView = _tabBarController.view;
UIView *colorView = [[UIView alloc] initWithFrame:topView.frame];
[colorView setBackgroundColor:[UIColor blueColor]];
[topView addSubview:colorView];
[topView bringSubviewToFront:colorView];
}