我正试图在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。但是找不到答案。
答案 0 :(得分:4)
actionSheet = [[UIActionSheet alloc] initWithTitle:@"Title"
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:@"Ok"];
而不是零值,请使用@&#34;&#34;
actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:nil
cancelButtonTitle:@""
destructiveButtonTitle:nil
otherButtonTitles:nil];
答案 1 :(得分:0)
我从@Sunny shah的答案中解决了这个问题。我试过他的答案,但在行动表上有title
。相反,我尝试使用下面的代码。(标题名称为单个空格)。
self.dobActionSheet = [[UIActionSheet alloc] initWithTitle:@" " delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil,nil];