daa*_*aal 0 iphone fonts ios swift
当我在故事板中时,导航栏标题在故事板中默认显示为粗体,但是当您在模拟器和设备中运行应用程序时,它不是粗体.令人讨厌的是,无法从界面构建器更改字体大小.
您可以在下面看到界面构建器和模拟器上显示的内容之间的区别.
我知道我可以使用类似的东西更改字体:self.navigationController?.navigationBar.titleTextAttributes = [NSFontAttributeName: UIFont(name: "YOUR-FONT-NAME-WEIGHT", size: 24)!
这将是完美的但我想将字体保持为默认的SF字体.
有解决方法吗?出现这种情况的原因是什么
在您的代码中使用此代码viewDidLoad来更改字体大小
self.navigationController?.navigationBar.titleTextAttributes = [
NSFontAttributeName: UIFont.systemFont(ofSize: 20, weight: UIFontWeightHeavy)
]
Run Code Online (Sandbox Code Playgroud)
对于快速4:
self.navigationController?.navigationBar.titleTextAttributes = [
NSAttributedStringKey.font: UIFont.systemFont(ofSize: 20, weight: UIFont.Weight.heavy)
]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3465 次 |
| 最近记录: |