iOS的UIAlertController大胆的按钮,在8.3改变 [英] iOS UIAlertController bold button changed in 8.3

查看:271
本文介绍了iOS的UIAlertController大胆的按钮,在8.3改变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UIAlertController与风格的两个按钮设置:

UIAlertController with two buttons with styles set:

UIAlertActionStyle.Cancel
UIAlertActionStyle.Default

在iOS的8.2,取消按钮是不可大胆默认为粗体。
在iOS 8.3版本,他们已经转向轮

in iOS 8.2, the Cancel button is non-bold and Default is bold. In iOS 8.3 they have switched round

您可以看到苹果自己的应用例如,设置>邮件>添加帐户>的iCloud>输入无效数据,那么就说明这样的8.3:

You can see it Apple's own apps e.g., Settings > Mail > Add Account > iCloud > enter invalid data, then it shows like this on 8.3:

不支持的Apple ID

Unsupported Apple ID

了解更多(粗体)
OK(非粗体)

Learn More (bold) OK (non-bold)

而这是其他方式轮8.2。

whereas it was the other way round for 8.2.

任何解决方法,以使它像8.2试。为什么会改变?

Any workaround to make it like 8.2 again. Why has it changed?

推荐答案

从iOS的9,您可以设置 preferredAction 值设置为你想要的按钮的动作标题要大胆。

From iOS 9 you can set the preferredAction value to the action which you want the button title to be bold.

    let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)
    let OKAction = UIAlertAction(title: "OK", style: .Default, handler: nil)
    alert.addAction(cancelAction)
    alert.addAction(OKAction)
    alert.preferredAction = OKAction
    presentViewController(alert, animated: true) {}

确定按钮,在右侧会以加粗字体。

The OK button which is on the right will be in bold font.

这篇关于iOS的UIAlertController大胆的按钮,在8.3改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆