【发布时间】:2019-02-06 08:28:07
【问题描述】:
启用大标题时,当标题处于“小”状态时,视图的标题始终居中。我该如何改变?
我无法将自定义 UILabel 设置为 titleView,因为这种方法也会影响大标题。
所以我尝试了这个:
let paragraph = NSMutableParagraphStyle()
paragraph.alignment = .left
let attributes = [NSAttributedStringKey.foregroundColor:UIColor.black,
NSAttributedStringKey.paragraphStyle:paragraph]
self.navigationBar.titleTextAttributes = attributes
但不幸的是,这根本不会影响标题在其小状态下的对齐方式。 (换色有效)
【问题讨论】:
-
不是重复的。您的链接问题与大标题无关。
标签: ios swift uinavigationcontroller alignment nsattributedstring