开发者

Why do I get 'No -renderInContext: method found' warning?

I get a compiler warning at the -renderInContext:

- (UIImage *) imageFromView:(UIView *)view {
    UIGraphicsBeginImageContextWithOption开发者_运维问答s(view.bounds.size, view.opaque, 0.0);
    [view.layer renderInContext:UIGraphicsGetCurrentContext()]; 
    UIImage * img = UIGraphicsGetImageFromCurrentImageContext();    
    UIGraphicsEndImageContext();
    return img; 
}

I have QuartzCore in the project frameworks, and the code works. How do I fix the code so it stops giving me the warning?

The exact warning I get is

warning: no '-renderInContext:' method found
warning: (Messages without a matching method signature
warning: will be assumed to return 'id' and accept
warning: '...' as arguments.)


Try importing the Quartz framework into your application.

Then add,

#include <QuartzCore/QuartzCore.h>

to your application.


Do you have QuartzCore.framework in your project?


I suppose it's due to the fact that the CALayer class header is in the QuartzCore framework.

In Xcode, in the Frameworks group, add the QuartzCore framework and it should be all fine.

Then, see my post here on SO for how to include the header files in every source file. Now it's not for Core Data, but for QuartzCore (in the exact same way)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜