ios中的屏幕截图(UIView方法)
2016-06-21 本文已影响1340人
helinyu
- (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates ;
- (UIView *)resizableSnapshotViewFromRect:(CGRect)rect afterScreenUpdates:(BOOL)afterUpdates withCapInsets:(UIEdgeInsets)capInsets ;
- (BOOL)drawViewHierarchyInRect:(CGRect)rect afterScreenUpdates:(BOOL)afterUpdate
(uiview中的快照的介个方法)
![](https://img.haomeiwen.com/i1205674/96998f9eeff5cb0f.png)
self.snapImageView = (UIImageView*) [self.view snapshotViewAfterScreenUpdates:true];(简单)
这个方法直接就可以获取到截取的图片,然后就可以用来实现设置相应的内容。
可参考的链接