iOS UIScrollView跨屏截图

释放双眼,带上耳机,听听看~!

UIScrollView跨屏截图,适用UItableView

- (UIImage*)getCapture
{
UIImage* viewImage = nil;
UIScrollView *scrollView = self.scrollViewCard;
UIView *sView = self.viewContent;
UIGraphicsBeginImageContextWithOptions(scrollView.contentSize, scrollView.opaque, 0.0);
{
CGPoint savedContentOffset = scrollView.contentOffset;
CGRect savedFrame = scrollView.frame;
scrollView.contentOffset = CGPointZero;
scrollView.frame = CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height);
[sView.layer renderInContext: UIGraphicsGetCurrentContext()];
viewImage = UIGraphicsGetImageFromCurrentImageContext();
scrollView.contentOffset = savedContentOffset;
scrollView.frame = savedFrame;
}
UIGraphicsEndImageContext();
return viewImage;
}

人已赞赏
iOS文章

RuntimeError - [Xcodeproj] Unknown object version.

2020-3-25 7:59:52

iOS文章

Mac 设置文件默认打开方式

2020-3-25 11:09:40

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
有新消息 消息中心
搜索