Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change sequence of button in UIActionsheet in iPhone?

I have 4 buttons in UIActionsheet from Top to Bottom Sequence is as below
1. Remove existing photo - Destructive button title
2. take picture - other button title
3. choose from library - other button title
4. Cancel - cancel button title

Now what my question is i found my 1st button "Remove existing photo" in red color obviously and i want my 1st button at 3rd place with red color and other buttons as 1st button and 2nd button but don't know how i can get it.

like image 978
dks1725 Avatar asked Jun 15 '11 06:06

dks1725


2 Answers

You can use destructiveButtonIndex to set the 3rd button as destructive button.

like this actioinSheet.destructiveButtonIndex = 3;

like image 105
Robin Avatar answered Oct 31 '22 16:10

Robin


Action sheet buttons appear in the order in which you add them to the action sheet. Add them in the order in which you would like them to appear. You can set the cancelButtonIndex and destructiveButtonIndex to determine which buttons should be styled with the cancel and destructive styles.

like image 4
Jonah Avatar answered Oct 31 '22 16:10

Jonah