scrollerView截图方法

/**

*截取scrollview整个图片

*/

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()];

_viewImage = UIGraphicsGetImageFromCurrentImageContext();

_scrollView.contentOffset = savedContentOffset;

_scrollView.frame = savedFrame;

}

UIGraphicsEndImageContext();

你可能感兴趣的:(scrollerView截图方法)