在我的iOS應用程序的代碼,我服用的UIImageView的截圖,但我需要它的時候它不是通過下面的代碼正確服用。截圖是不是在適當的大小IOS
func captureView() -> UIImage {
// let rect: CGRect = self.imageView.bounds
UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, false, 0.0)//add this line
let context: CGContextRef = UIGraphicsGetCurrentContext()!
self.view.layer.renderInContext(context)
let img: UIImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return img
}
我想要在imageView中執行圖像的屏幕截圖,因爲它上面有更多的圖像。 請建議我適當的代碼獲得確切的UIImageView截圖
添加
UIScreen.mainScreen().scale
,而不是0.0
我想的ImageView的圖像exect屏幕截圖,因爲有它更多的圖像。手段顯示我的屏幕截圖 –這是簡單的imageView ..我想拍的那個.. – JAck
只是Imageview不是總屏幕 –