2
在我的iOS应用程序中,我采取了UIImageView的屏幕截图。如附件照片所示,它非常完美。但在这里,我已采取UIImageView content mode
方面适合。我已经使用这个代码。截图UIImageView我只需要图像IOS
func captureView() -> UIImage {
UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, false,UIScreen.mainScreen().scale)//add this line
let context: CGContextRef = UIGraphicsGetCurrentContext()!
self.backView.layer.renderInContext(context)
let img: UIImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return img
}
我只需要Image的快照,而不是ImageView。帮我介绍一下。
尝试[此](http://stackoverflow.com/a/6284498/790842)来获得图像的确切大小和尺寸提供给代码当你制作截图时,尽管你也需要调整frame.x。 – iphonic
获取图像视图的图像,'imageView.image' – zylenv
@zylenv没有试图让那种容易的事情 – JAck