我最近更新到 Xcode 6.1 并一直在努力修复出现的一些错误。我注意到的一个问题是我当前用于设置 CGContextDrawImage 图像的代码不再有效。
这是我当前的代码:
CGContextDrawImage(ctx, self.bounds, UIImage(named: "RadialProgressFillOver"))
我刚得到错误:
Cannot invoke 'init' with an argument list of type
我已经尝试了一些事情并进行了一些搜索,但我还没有找到任何解决 6.1 更改内容的方法。我哪里错了?
最佳答案
CGContextDrawImage
的第三个参数是 CGImageRef!
。所以使用:
CGContextDrawImage(ctx, self.bounds, UIImage(named: "RadialProgressFillOver")?.CGImage)
不幸的是,其中一些警告可能会产生误导,因此您可能必须逐个检查每个参数,并非常仔细地仔细检查类型和可选性。
关于ios - Xcode 6.1 中的 CGContextDrawImage 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26695142/