ios - 带有属性文本的 UIButton 不遵守 adjustsFontSizeToFitWidth

标签 ios uibutton swift2

关于为什么在 IB 上设置了属性文本的 UIButton 不遵守 adjustsFontSizeToFitWidth 的任何想法。

 button.titleLabel?.numberOfLines = 3
 button.titleLabel?.adjustsFontSizeToFitWidth = true
 button.titleLabel?.lineBreakMode = .//tried all options here....
 button.titleLabel?.minimumScaleFactor = 0.2

最佳答案

adjustsFontSizeToFitWidth 不适用于属性字符串,您必须自己手动设置适当的字体大小

关于ios - 带有属性文本的 UIButton 不遵守 adjustsFontSizeToFitWidth,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37232855/

相关文章:

swift - 是否可以播放存储在 Apple Watch 上的音乐?

ios - 将目标添加到属于不同对象的选择器

xcode - 无法到达数组->字典->集合

ios - 如何在 UITableViewCell 中显示红色 "Cancel"按钮?

ios - Xamarin UIButton 有多个事件处理程序

ios - 在 iOS 上按需资源下载没有错误,但不可用

ios - 是否可以使用 RxSwift 和 Moya 映射到 "fallback"Decodable?

ios - 从 UIButton 中获取 UIButton 的标签,该 UIButton 位于此 UIButton 呈现的弹出窗口中

ios - 当 UIApplicationWillEnterForeground 时运行动画

iOS : Share with UIActivityViewController & Default applications