ioslarge-titlepreferslargetitles

Is there any way to change the iOS Large Title left margin?


I would like to know if is there any way to change the iOS Large Title left margin property. I tried to find the answer for it on the web, but I did not succeed.


Extra question: is the default margin between items and the horizontal sides of the screen 15? The reason I am asking this is because I am trying to align the large title with the rest of the elements of my app, that has 15 left/right margin to the screen.

Thank you :)


Solution

  • You can do something like this:

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

    Assuming that the 'rest of the elements' in your 'extra question' are tableview items, then yes, 15 seems to be a default margin: Why UITableView cell separatorInset is default to 15, when view controller's root view Layout Margins is 16?