XCode 4 - 警告 - (void)renderInContext:(CGContextRef)ctx

时间:2011-09-03 01:43:17

标签: iphone cocoa-touch core-graphics warnings

我有这段代码:

+ (UIImage*) someImageMethod:(UIImage*)originalImage {
    UIImageView *tempImageView = [[UIImageView alloc] initWithImage:originalImage];

    UIGraphicsBeginImageContext(tempImageView.frame.size);
    CGContextRef context = UIGraphicsGetCurrentContext();

    ...    

    [tempImageView.layer renderInContext:context];

    ...    
}

这会生成持续警告:No '-RenderInContext' method found.

为什么会出现这样的错误?我怎么能让它消失?

1 个答案:

答案 0 :(得分:4)

确保 #import <QuartzCore/QuartzCore.h> ,并将框架添加到您的项目中。