当我尝试关闭 UIImageView
时
- (void)handleGesture:(UIGestureRecognizer *)gestureRecognizer {
CGPoint p = [gestureRecognizer locationInView:self.view];
if (CGRectContainsPoint(_tutorial.frame, p)) {
_tutorial.hidden = YES;
_transButton.enabled = YES;
_transButtonEng.enabled = YES;
_infoButton.enabled = YES;
_textfield.enabled = YES;
}
else {
NSLog(@"HOW IS THIS EVEN POSSIBLE?!?!?"); //The CGRect is the whole screen
}
}
我收到此错误消息:
MacBook-Pro.local APP_NAME[97086] : CGContextSetFillColorWithColor: 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.
它还用 CGContextSetFillColorWithColor:
替换为:
CGContextSetStrokeColorWithColor:
CGContextSaveGState:
CGContextSetFlatness:
CGContextAddPath:
CGContextDrawPath:
CGContextRestoreGState:
CGContextSaveGState:
CGContextSetFlatness:
CGContextAddPath:
CGContextDrawPath:
CGContextRestoreGState:
CGContextSetFillColorWithColor:
CGContextSetStrokeColorWithColor:
CGContextSetFillColorWithColor:
CGContextSetStrokeColorWithColor:
CGContextGetBlendMode:
CGContextSetBlendMode:
CGContextFillRects:
CGContextSetBlendMode:
CGContextSetFillColorWithColor:
CGContextSetStrokeColorWithColor:
CGContextGetBlendMode:
CGContextSetBlendMode:
CGContextFillRects:
CGContextSetBlendMode:
CGContextSetFillColorWithColor:
CGContextSetStrokeColorWithColor:
CGContextGetBlendMode:
CGContextSetBlendMode:
CGContextFillRects:
CGContextSetBlendMode:
我使用的是最新版本的 Xcode 5 和 iOS 7.0.3。
我该如何修复这些错误?
最佳答案
隐藏_tutorial
imageView 后,您应该删除手势识别器(通过 UIGestureRecgonizer 的 "removeTarget: action:
" API ,这样您就不会调用“CGRectContainsPoint
”一个隐藏的 View ,谁知道帧值是什么。
关于ios - 关闭 UIImageView 时无效的上下文 0x0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20038701/