微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

swift3 – swift 3和CGContextEOClip

当我将我的代码转换swift 3时,我收到了这个错误

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?)

我不知道如何使用剪辑(使用:),我没有看到任何与它相关的文档.
有任何想法吗.
谢谢
雷扎

解决方法

在swift3中,CGContextEOClip和CGContextClip现在是CGContext类型的方法

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐