2016-09-19 77 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