/**
* 某个View单独进行截图
*/
- (UIImage *)snapshotSingleView:(UIView *)view
{
CGRect rect = view.frame;
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[view.layer renderInContext:context];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}IOS7之后新增API支持单独截图莫个View
- (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates NS_AVAILABLE_IOS(7_0);
本文介绍了一个简单的iOS方法,用于对指定的UIView进行截图,并利用了iOS 7之后新增的API来实现这一功能。
7

被折叠的 条评论
为什么被折叠?



