我尝试在大标题模式下将标题居中,但该代码不影响。在 AppDelegate 中:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = .center
UINavigationBar.appearance().largeTitleTextAttributes = [NSAttributedStringKey.paragraphStyle: paragraphStyle]
return true
}
Best Answer-推荐答案 strong>
大标题不能居中,它的位置在左边并且左对齐。标题的大小无关紧要,如果您希望标题居中,则必须创建自己的自定义标题。
关于ios - 大标题,居中对齐,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/48729077/
|