2017-05-23 66 views
0

我正在嘗試在我的Xcode項目中實施裁剪窗格。裁剪出現圖像錯誤

我得到這個錯誤,我不知道爲什麼。

任何人都可以幫忙。

let imageRef = imageToCrop!.cgImage!.cropping(to: visibleRect) 
    let result = UIImage(CGImage: imageRef!, scale: imageToCrop!.scale, 
     orientation: imageToCrop!.imageOrientation) 

    return result 
} 

,但得到這個錯誤

不明確使用 '的init(CGImage:規模:定向:)'

回答

4

這是init(cgImage:scale:orientation:)init(CGImage:scale:orientation:)

let result = UIImage(cgImage: imageRef!, scale: imageToCrop!.scale, orientation: imageToCrop!.imageOrientation) 
+0

謝謝你,這對我幫助很大.... –

+0

你應該投票關閉這個問題作爲一個錯字或問題,可以不再重現。 – JAL