简体   繁体   English

Xcode 6.1中的CGContextDrawImage错误

[英]CGContextDrawImage error in Xcode 6.1

I recently updated to Xcode 6.1 and have been working through fixing some bugs that have arisen. 我最近更新到Xcode 6.1,并一直在解决一些已出现的错误。 One issue I noticed was that my current code for setting the image of CGContextDrawImage no longer works. 我注意到的一个问题是,当前用于设置CGContextDrawImage图像的代码不再起作用。

This is my current code: 这是我当前的代码:

    CGContextDrawImage(ctx, self.bounds, UIImage(named: "RadialProgressFillOver"))

I just get the error: 我只是得到错误:

Cannot invoke 'init' with an argument list of type

I've tried a few things and did some searching but I haven't found any solution to what to change for 6.1. 我已经尝试了一些方法并进行了一些搜索,但是我还没有找到任何针对6.1进行更改的解决方案。 Where am I going wrong? 我要去哪里错了?

The third parameter to CGContextDrawImage is a CGImageRef! CGContextDrawImage的第三个参数是CGImageRef! . So use: 因此使用:

CGContextDrawImage(ctx, self.bounds, UIImage(named: "RadialProgressFillOver")?.CGImage)

Unfortunately, some of these warnings can be misleading, so you may have to go through each of the parameters, one by one, and carefully check both the type and optionality very carefully. 不幸的是,其中一些警告可能会误导您,因此您可能必须逐个检查每个参数,并非常仔细地仔细检查类型和可选性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM