ios - 我们如何从 iphone(在我的应用程序中)的设置中禁用已启用 "bold text"的效果? - swift 2.0

标签 ios xcode swift ios8 ios9

如果用户的设备启用了粗体文本,系统的某些部分会自动响应。例如,如果您在应用中使用默认导航 Controller 屏幕顶部的标题和 UIBarButtonItem 将变为粗体。

如何禁用粗体文本我的所有应用的影响,特别是对默认导航的影响我的应用程序中的 Controller (到 titleUIBarButtonItem )? - swift 2.0(iOS 8 和 9)。谢谢大家:)

我有这段代码来检测是否启用了粗体文本:(如果有用)

 if (UIAccessibilityIsBoldTextEnabled()) { // use bold font 
       }
 else { 
    // use standard font
}

最佳答案

如果您的条形按钮项目使用默认(系统)字体,并且如果用户启用粗体文本,您的屏幕文本将变为粗体。使用常规文本自定义栏按钮项目的字体。

let barButton = UIBarButtonItem.appearance()
if let font = UIFont(name: "HelveticaNeue", size: 19) {     
    barButton.setTitleTextAttributes([NSFontAttributeName: font], forState: UIControlState.Normal) 
}

关于ios - 我们如何从 iphone(在我的应用程序中)的设置中禁用已启用 "bold text"的效果? - swift 2.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32761868/

相关文章:

iphone - 在iOS中加快精简版TTS

ios - 您无权使用此服务 iTunes 应用上传错误

ios - PFUser/PFInstallaion saveEventually - 调用中参数 #1 缺少参数

swift - MacOS Playground : How can change the background color?

显示无效二进制 Xcode 11 beta 6 的 iOS 应用程序

iphone - UITableViewController 第二次加载时崩溃

ios - 为带有字幕的 HTTP 实时流媒体编码视频

ios - 显示 UITableViewCell 时,CAGradientLayer 无法正确调整大小

ios - 将 AVPlayerItem 保存到文档目录

ios - Swift 2.0 中的 FetchRequest 崩溃