How to change sequence of button in UIActionsheet in iPhone?
Asked Answered
O

2

11

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.

Oyez answered 15/6, 2011 at 6:7 Comment(0)
T
45

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

like this actioinSheet.destructiveButtonIndex = 3;

Trichinopoly answered 15/6, 2011 at 6:16 Comment(1)
small detail, but actioinSheet should maybe be actionSheetShirt
O
4

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.

Onomastics answered 15/6, 2011 at 6:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.