Пользователь
- (void)applicationDidEnterBackground:(UIApplication *)application { UIGraphicsBeginImageContext(self.window.bounds.size); [self.window.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); NSData * pngData = UIImagePNGRepresentation(viewImage); NSArray* dirs = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString* documentsPath = [dirs objectAtIndex:0]; NSString * splashDest = [documentsPath stringByAppendingPathComponent:@"Splash.png"]; [pngData writeToFile:splashDest atomically:NO]; }
Так, например с версии iOS 3.2 убрали возможность ставить полупрозрачные иконки для приложений.
Хотя ничто не предвещало беды.
- (void)applicationDidEnterBackground:(UIApplication *)application {
UIGraphicsBeginImageContext(self.window.bounds.size);
[self.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData * pngData = UIImagePNGRepresentation(viewImage);
NSArray* dirs = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* documentsPath = [dirs objectAtIndex:0];
NSString * splashDest = [documentsPath stringByAppendingPathComponent:@"Splash.png"];
[pngData writeToFile:splashDest atomically:NO];
}