-1

I'm trying to show UIActionSheet in self.view.parentview. But I got below warning while running

<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.

Code is below

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];

I've put breakpoint. but get this warning in this line [self.dobActionSheet showInView:self.parentViewController.view];..

I've try to present in Viewcontroller which is embedded in tabbarController at first index. That's why, try to present with parentViewController.view instead self.view

Note: I've seen as same question here. But couldn't find answer for this.

Community
  • 1
  • 1
Mani
  • 17,549
  • 13
  • 79
  • 100
  • Try with [self.dobActionSheet showInView:self.view]; – iPatel Feb 28 '14 at 05:57
  • I couldn't do this. Because this viewcontroller is embedded in tabbarcontroller at first index. Is it correct way to do it? Any way tried this, but got same error.. !! – Mani Feb 28 '14 at 05:59
  • possible duplicate:http://stackoverflow.com/a/19111512/544265 – c0ming Feb 28 '14 at 06:12
  • @c0ming thanks for your link. I've tried this but it doesn't work for me. – Mani Feb 28 '14 at 06:29

2 Answers2

4
actionSheet = [[UIActionSheet alloc] initWithTitle:@"Title"
                                              delegate:self
                                     cancelButtonTitle:nil
                                destructiveButtonTitle:nil
                                     otherButtonTitles:@"Ok"];

instead of nil value, use @""

actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:nil
cancelButtonTitle:@""
destructiveButtonTitle:nil
otherButtonTitles:nil];
Sunny Shah
  • 12,990
  • 9
  • 50
  • 86
  • Action sheet show title.. So I tried with single space as title. It's working. see my answer.. thanks +1 for U:) – Mani Feb 28 '14 at 06:38
0

I've solved this issue from @Sunny shah answers. I've tried with his answer but have title on action sheet. Instead I tried with below code.(Title name as single space).

self.dobActionSheet = [[UIActionSheet alloc] initWithTitle:@" " delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil,nil];
Mani
  • 17,549
  • 13
  • 79
  • 100