ios - 关闭 UIImageView 时无效的上下文 0x0

标签 ios cocoa-touch uiimageview

当我尝试关闭 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/

相关文章:

ios - iOS SDK 发送 SNS 通知的消息格式是什么?

ios - 如何修复错误 : init(boundsSize:requestHandler:)’ is only available on iOS 10. 0

objective-c - 在给定索引上启动 UIPageViewController

ios - 创建自定义模糊 UIView

ios - 如何使用 AVFoundation 捕获静态图像并使用 Swift 在另一个 View Controller 中显示图像

ios - 旋转UIImage并移动

iphone - 动画 UITableView 重新加载导致每个单元格立即加载

ios - swift:完成处理程序

iphone - UITableView 变成 UIScrollView?

ios - 自动增强 UIImageView 且不旋转