1.别去找截图的方法了,直接将UIView对象转成图片就完事了
将UIView转换成UIimage
- (UIImage *)pb_takeSnapshot {
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, [UIScreen mainScreen].scale);
//这个是截图的核心方法,别用snapshotViewAfterScreenUpdates方法,它会把截图转成一个view,你可以试试把它转成的view再去转image,会搞死人的
[self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
//调用
UIImage *snapIcon =[self pb_takeSnapshot];
分享自己搞去