gpt4 book ai didi

javascript - React-Native AlertIOS 风格

转载 作者:行者123 更新时间:2023-11-27 23:28:38 25 4
gpt4 key购买 nike

AlertIOS ,您可以根据我的观察指定这些按钮样式:

  1. “默认”:蓝色,普通文本
  2. “取消”:蓝色,粗体文本
  3. “破坏性”:红色,普通文本

我假设此命名约定与 native UIAlertView 样式类相对应,对吗?对于我的应用程序中的警报,我想用粗体和蓝色文本强调积极的操作,因此我很奇怪这些操作设置有“取消”样式属性。是我个人这么认为还是“取消”风格用词不当?

AlertIOS.prompt("Enter a new name", null, [
{
text: "Update",
style: "cancel",
onPress: (name) => { this.updateName(name); }
},
{
text: "Cancel",
style: "destructive"
}
]);

最佳答案

此命名约定与 UIAlertView(已弃用)无关,而是与其替代品 - iOS8 中引入的 UIAlertController 相关。

使用 UIAlertView 时不必指定按钮标题,而是使用 UIAlertController 添加操作。每个操作都有其“操作样式”(默认/取消/破坏性),它在警报中转换为具有相应样式的按钮,由字体和颜色定义。

有关取消样式的 Apple 文档指出:

Apply a style that indicates the action cancels the operation and leaves things unchanged

我猜苹果认为这种风格强调的是这样的操作将“保持不变”。也许是为了向用户强调这是他的“出路”,所以他们让它对用户来说更加突出。

关于javascript - React-Native AlertIOS 风格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34751179/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com