【发布时间】:2014-02-28 05:53:53
【问题描述】:
我正在尝试在self.view.parentview 中显示 UIActionSheet。但我在运行时收到以下警告
<Error>: 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.
<Error>: CGContextSetStrokeColorWithColor: 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.
<Error>: 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.
代码如下
self.dobActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil,nil];
[self.dobActionSheet addSubview:self.doneForActionSheet];
[self.dobActionSheet addSubview:self.cancelForActionSheet];
[self.dobActionSheet addSubview:self.dobDatepicker];
[self.dobActionSheet showInView:self.parentViewController.view];
我已经设置了断点。但在这一行得到这个警告[self.dobActionSheet showInView:self.parentViewController.view];..
我尝试在第一个索引处显示Viewcontroller,即embedded in tabbarController。这就是为什么,尝试使用parentViewController.view 而不是self.view 进行演示
注意:我看到了同样的问题here。但找不到答案。
【问题讨论】:
-
试试 [self.dobActionSheet showInView:self.view];
-
我做不到。因为这个视图控制器在第一个索引处嵌入在 tabbarcontroller 中。这是正确的方法吗?任何方式都试过这个,但得到了同样的错误.. !!
-
@c0ming 感谢您的链接。我已经尝试过了,但它对我不起作用。
标签: ios datepicker uiactionsheet