是因为iPhone7或iPhone7plus中的
UIView * fromTempView = [fromVC.view snapshotViewAfterScreenUpdates:NO];
方法失效,
改成
- (UIView *)imageFromView:(UIView *)snapView{ UIGraphicsBeginImageContext(snapView.frame.size); CGContextRef context = UIGraphicsGetCurrentContext(); [snapView.layer renderInContext:context]; UIImage * targetImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageView * tmpView = [[UIImageView alloc] initWithImage:targetImage]; snapView.frame = snapView.frame; return tmpView; }
方法即可。