【问题标题】:Is there any way to change the iOS Large Title left margin?有什么办法可以改变 iOS 大标题的左边距?
【发布时间】:2018-07-05 09:53:24
【问题描述】:

我想知道是否有任何方法可以更改 iOS 大标题左边距属性。我试图在网上找到它的答案,但我没有成功。


额外的问题:项目和屏幕水平边之间的默认边距是 15 吗?我问这个的原因是因为我试图将大标题与我的应用程序的其余元素对齐,屏幕有 15 个左右边距。

谢谢你:)

【问题讨论】:

    标签: ios large-title preferslargetitles


    【解决方案1】:

    你可以这样做:

    let style = NSMutableParagraphStyle()
    style.firstLineHeadIndent = 10 // This is added to the default margin
    UINavigationBar.appearance().largeTitleTextAttributes = [NSAttributedStringKey.paragraphStyle : style]
    

    假设您的“额外问题”中的“其余元素”是表格视图项目,那么是的,15 似乎是默认边距:Why UITableView cell separatorInset is default to 15, when view controller's root view Layout Margins is 16?

    【讨论】:

    • 这项工作在 iOS 12 上运行,但在 iOS 11 上它削减了标题的尾部。 iOS 11 的任何解决方案?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-04-18
    • 2017-01-10
    • 2019-12-26
    • 1970-01-01
    • 1970-01-01
    • 2021-12-23
    • 2011-02-14
    相关资源
    最近更新 更多