iOS7 后的屏幕截图方式
2016-04-07 本文已影响72人
旺仔爸
- (UIImage *)snapshot:(UIView *)view
{
UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, 0);
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
官方文档 https://developer.apple.com/library/ios/qa/qa1817/_index.html