ios生成长图

+(UIImage )captureScrollView:(UIScrollView )scrollView{
UIImage *image = nil;
UIGraphicsBeginImageContext(scrollView.contentSize);
{
CGPoint savedContentOffset = scrollView.contentOffset;
CGRect savedFrame = scrollView.frame;
scrollView.contentOffset = CGPointZero;
scrollView.frame = CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height);

    [scrollView.layer renderInContext: UIGraphicsGetCurrentContext()];
    image = UIGraphicsGetImageFromCurrentImageContext();

    scrollView.contentOffset = savedContentOffset;
    scrollView.frame = savedFrame;
}
UIGraphicsEndImageContext();

if (image != nil) {
    return image;
}
return nil;

}

阅读更多
文章标签: uiimage uiscrollview
上一篇ios进制相互转换
下一篇BaseModel
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭