dks1725
dks1725

Reputation: 1631

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.

Upvotes: 11

Views: 6136

Answers (2)

Jonah
Jonah

Reputation: 17958

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.

Upvotes: 4

Robin
Robin

Reputation: 10011

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

like this actioinSheet.destructiveButtonIndex = 3;

Upvotes: 45

Related Questions