Sometimes when I open my app (either while resuming it after it was dormant for a while or while opening it after it has been \'quit\'), the splash screen, which basically j
Device os create snapshot screen image when application goes in background, here is path you can find in sandbox of application "AppData/Library/Caches/Snapshots/".
Here is a trick that you can prevent to show last screen of app, when you launch application.
// Create subclass of UIImageView
@interface SnapShotImageView :UIImageView
@end
@implementation SnapShotImageView :UIImageView
@end
// Create function in appdelegate.m
- (void)createSnapshotWhileApplicationGoesInBackground{
NSString *splashImg = nil;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
splashImg= @"Default~ipad.png";
}
else {
splashImg= @"Default~iphone.png";
}
UIWindow *win = [[UIApplication sharedApplication] keyWindow];
SnapShotImageView *splash = [[SnapShotImageView alloc] initWithImage:[UIImage imageNamed:splashImg]];
splash.frame = self.window.bounds;
[win addSubview:splash];
}
- (void)removeSnapshotFromWindow{
UIWindow *win = [[UIApplication sharedApplication] keyWindow];
if ([[win subviews] count] > 1) {
[NSThread sleepForTimeInterval:0.5];
NSArray *array = [win subviews];
[array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
if ([obj isKindOfClass:[SnapShotImageView class]]) {
[obj removeFromSuperview];
}
}];
}
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
[self removeSnapshotFromWindow];
}
//Call this function Application delegate method this way..
- (void)applicationDidEnterBackground:(UIApplication *)application {
[self createSnapshotWhileApplicationGoesInBackground];
}
- (void)applicationWillEnterForeground:(UIApplication *)application{
[self removeSnapshotFromWindow];
}
- (void)applicationDidBecomeActive:(UIApplication *)application{
[self removeSnapshotFromWindow];
}
here we creating snapshot of splash screen.. just adding splash screen in window. when application goes in background
and removeing snapshot when application comes in foreground