【发布时间】:2014-04-02 16:29:21
【问题描述】:
我在UIViewController 中有一个UIImageView,并且想在现有的imageView 上添加一个简单的图像。
viewDidLoad 方法如下所示:
UIImage *test;
test = [UIImage imageNamed:@"position-dot.png"];
[test drawAtPoint:CGPointMake(100,100) ];
我收到的部分错误消息如下所示:
CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
CGContextSetBlendMode: invalid context 0x0. This is a serious error.
我测试了重置我的 iOS 模拟器(其他线程中关于此的解决方案),但这并没有解决问题。
【问题讨论】:
-
您想在
UIImageView上显示UIImage还是在它当前显示的内容之上呈现它? -
您应该能够通过将代码包装在对 UIGraphicsBeginImageContext() 和 UIGraphicsEndImageContext() 的调用中来解决此问题。
-
@Alladinian:第二种选择。在它当前显示的内容之上。
-
geraldWilliam,你有例子吗?
-
您是否可以选择使用第二个 UIImageView?
标签: ios iphone uiviewcontroller uiimageview cgcontextdrawimage