Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIActionSheet cancel button not dismissing actionsheet

I have an UIActionSheet and I am specifying the cancel button however it does not dismiss when its tapped?

UIActionSheet *actionSheet = [[[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Target Complete" otherButtonTitles:nil] autorelease]; 
[actionSheet showInView:self.view];

According to the documentation I don't need any code and even when I try and implement the didCancel delegate method its never called?

like image 828
TheLearner Avatar asked Dec 18 '11 08:12

TheLearner


2 Answers

Try this

[actionSheet showInView:[self.view window]];

UIActionSheet cancel button strange behaviour

like image 160
nevan king Avatar answered Oct 18 '22 18:10

nevan king


This Will do the trick

[actionSheet showInView:[self.view window]];

instead of

[actionSheet showInView:self.view];
like image 14
hac.jack Avatar answered Oct 18 '22 17:10

hac.jack