OGeek|极客世界-中国程序员成长平台

标题: ios - 大标题,居中对齐 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:44
标题: ios - 大标题,居中对齐

我尝试在大标题模式下将标题居中,但该代码不影响。在 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-推荐答案


大标题不能居中,它的位置在左边并且左对齐。标题的大小无关紧要,如果您希望标题居中,则必须创建自己的自定义标题。

关于ios - 大标题,居中对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48729077/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4