Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add UIActionSheet without cancel button

Tags:

xcode4

i want to use UIActionSheet to allow user to choose one of two modes of my iphone app. so i do not need to show cancel button. i just want to ask him if he want to choose mode one or two. i tried not to add it but it did not allow me so how can i do it ?

note : i do not want to use alerts.

i use this code for adding UIActionSheet:

UIActionSheet *mySheet = [[UIActionSheet alloc] initWithTitle:@"choose one" delegate:nil cancelButtonTitle:@"tasks" destructiveButtonTitle:@"appointments" otherButtonTitles:nil];


[mySheet showInView:self.view];
like image 322
etab Avatar asked Mar 27 '26 01:03

etab


1 Answers

Try:

UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"Share" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:@"Mode 1",@"Mode 2", nil];
[actionSheet showInView:self.view];

Just set the cancelButtonTitle to nil

like image 196
Abdullah Shafique Avatar answered Mar 31 '26 08:03

Abdullah Shafique



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!