Add space from the top for navigation title

别来无恙 提交于 2019-12-02 13:30:15

Try this code: Tested in Swift 3.

Note: Method 1 works only, If your VC embedded with navigationController.In your case you only using navigationBar to show title.So, use method 2.

Method 1:

 navigationController?.navigationBar.setTitleVerticalPositionAdjustment(5, for: UIBarMetrics.default) // set any number you want between -20 to 15

Method 2:

 navigationBar.setTitleVerticalPositionAdjustment(10, for: UIBarMetrics.default) // navigationBar is the name of your navBar..

Output:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!