2016-09-19 106 views
4

由於我我的代碼轉換爲SWIFT 3,我得到這個錯誤:迅速3和CGContextEOClip

error: 'CGContextEOClip' is unavailable: Use clip(using:) 
           CGContextEOClip(context!); 
           ^~~~~~~~~~~~~~~ 
CoreGraphics.CGContextEOClip:2:13: note: 'CGContextEOClip' has been explicitly marked unavailable here 
public func CGContextEOClip(_ c: CGContext?) 

我不知道怎麼用夾子(使用:)我沒有看到有關的任何文件到它。 任何想法。 感謝 禮

回答

9

在swift3 CGContextEOClipCGContextClip現在CGContext

let context = /*your context*/ 
context.clip(using: .evenOdd) // for CGContextEOClip 
context.clip(using: .winding) // for CGContextClip 
+0

燁的方法。 'CGContextEOClip'和'CGContextClip',以前的兩種不同的填充規則在剪裁時可能會有不同的功能,它們被統一爲一個採用填充規則參數的方法。 – rickster