For some unknown reason there seems to be a possible bug with all screenshot methods on the iPhone 6 simulator (and device). Whenever I call any of the screenshot methods including:
snapshotViewAfterScreenUpdates: resizableSnapshotViewFromRect: drawViewHierarchyInRect:
with afterScreenUpdates set to YES, the screen flickers. If set to NO, then no flicker occurs, but I am unable to get the functionality that I need.
These methods work fine with both iOS7.1 and iOS8 in all other simulators except for the iPhone 6 and 6+.
Strangely enough, if I start a brand new project using storyboards and try similar code I can't reproduce the flicker. I have attached a gif of the flicker using my non-storyboard project:
And here is the very simple view controller:
@implementation TestSnapshotController
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Snap" style:UIBarButtonItemStylePlain target:self action:@selector(_snap)];
self.blueView = [UIView new];
self.blueView.backgroundColor = [UIColor blueColor];
self.blueView.frame = CGRectMake(100.0f, 100.0f, 100.0f, 100.0f);
[self.view addSubview:self.blueView];
}
- (void)_snap
{
[self.blueView snapshotViewAfterScreenUpdates:YES];
}
@end
And here is my AppDelegate just in case:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
TestSnapshotController *testVC = [TestSnapshotController new];
UINavigationController *rootNavVC = [[UINavigationController alloc] initWithRootViewController:testVC];
self.window.rootViewController = rootNavVC;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
Any help would be greatly appreciated!