我需要在我的应用中截取一些图表的屏幕快照,
我正在使用以下代码:
CGRect screenRect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(screenRect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[UIColor blackColor] set];
CGContextFillRect(ctx, screenRect);
[self.view.layer renderInContext:ctx];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();但是在[self.view.layer renderInContext:ctx];中,我得到了警告Instance method -renderInContext: not found (return type defaults to id)
那么,我错过了什么?为了避免此警告并成功截取我的屏幕快照??
非常感谢!
发布于 2011-08-31 15:10:07
你需要#import <QuartzCore/QuartzCore.h>
https://stackoverflow.com/questions/7253624
复制相似问题