当跳转到先一个页面时候,将下一个页面的背景图设置成本页面的快照图片,这样就要使用下列方法;
chooseVC.view.backgroundColor=[UIColor clearColor];
if ([[[UIDevice currentDevice]systemVersion]floatValue]>=8.0) {
chooseVC.modalPresentationStyle=UIModalPresentationOverCurrentContext;
}else{
chooseVC.modalPresentationStyle=UIModalPresentationCurrentContext;
}
//NSLog(@"started: %s", __func__);
// UIGraphicsBeginImageContext([UIScreen mainScreen].bounds.size); //currentView 当前的view 创建一个基于位图的图形上下文并指定大小为
UIWindow *curWindow = [UIApplication sharedApplication].windows[0];
[curWindow.layer renderInContext:UIGraphicsGetCurrentContext()];//renderInContext呈现接受者及其子范围到指定的上下文
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();//返回一个基于当前图形上下文的图片
UIGraphicsEndImageContext();//移除栈顶的基于当前位图的图形上下文
// UINavigationController * navigation = [[UINavigationController alloc]initWithRootViewController:chooseVC];
[self presentViewController:chooseVC animated:YES completion:^{
chooseVC.view.backgroundColor=[UIColor colorWithPatternImage:viewImage];
}];