如何更改 iPhone 中 UIActionsheet 中按钮的顺序?
我在 UIActionsheet 中有 4 个按钮,从上到下顺序如下
1.删除现有照片 - 破坏性按钮标题
2. 拍照 - 其他按钮标题
3.从库中选择 - 其他按钮标题
4. 取消 - 取消按钮标题
现在我的问题是我找到了我的第一个按钮“删除现有照片”显然是红色的,我希望我的第一个按钮位于第三个位置,红色,其他按钮作为第一个按钮和第二个按钮,但不知道如何得到它。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
DestructiveButtonIndex
将第三个按钮设置为破坏性按钮。像这样
actioinSheet.destroyButtonIndex = 3;
You can use
destructiveButtonIndex
to set the 3rd button as destructive button.like this
actioinSheet.destructiveButtonIndex = 3;
操作表按钮按照您将其添加到操作表的顺序显示。按照您希望它们出现的顺序添加它们。您可以设置
cancelButtonIndex
和DestructiveButtonIndex
来确定哪些按钮应使用取消和破坏性样式。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
anddestructiveButtonIndex
to determine which buttons should be styled with the cancel and destructive styles.