首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >iOS截图警告

iOS截图警告
EN

Stack Overflow用户
提问于 2011-08-31 15:04:38
回答 1查看 757关注 0票数 2

我需要在我的应用中截取一些图表的屏幕快照,

我正在使用以下代码:

代码语言:javascript
运行
复制
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)

那么,我错过了什么?为了避免此警告并成功截取我的屏幕快照??

非常感谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-08-31 15:10:07

你需要#import <QuartzCore/QuartzCore.h>

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7253624

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档