简体   繁体   English

如何在 iPhone 的 UIActionsheet 中更改按钮的顺序?

[英]How to change sequence of button in UIActionsheet in iPhone?

I have 4 buttons in UIActionsheet from Top to Bottom Sequence is as below我在 UIActionsheet 中有 4 个按钮,从上到下顺序如下
1. Remove existing photo - Destructive button title 1.删除现有照片-破坏性按钮标题
2. take picture - other button title 2.拍照-其他按钮标题
3. choose from library - other button title 3.从库中选择-其他按钮标题
4. Cancel - cancel button title 4.取消- 取消按钮标题

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.现在我的问题是我发现我的第一个按钮“删除现有照片”显然是红色的,我希望我的第一个按钮在第三位,红色和其他按钮作为第一个按钮和第二个按钮,但不知道我怎么能得到它.

You can use destructiveButtonIndex to set the 3rd button as destructive button.您可以使用destructiveButtonIndex按钮索引 将第三个按钮设置为破坏性按钮。

like this actioinSheet.destructiveButtonIndex = 3;像这样actioinSheet.destructiveButtonIndex = 3;

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.您可以设置cancelButtonIndexdestructiveButtonIndex ButtonIndex 以确定哪些按钮应该使用取消和破坏性 styles 进行样式设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM