iOS学习记录

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

上一篇 下一篇

猜你喜欢

热点阅读