Cant change navigation bar height ios 11

微笑、不失礼 提交于 2021-02-18 19:12:27

问题


I cant change navigation bar frame in ios 11. Here is sample of my code for ios 10:

if let navigationBar = self.navigationController?.navigationBar {
    let frame = CGRect(x: navigationBar.frame.origin.x,
                       y: navigationBar.frame.origin.y,
                       width: navigationBar.frame.width,
                       height: navigationBar.frame.height + 100)
    navigationBar.frame = frame
}

ios 10 and ios 11 screenshots respectively


回答1:


Changing the height of the UINavigationBar is no longer directly supported in iOS 11 (see here, here & here).

The best you can hope for is to do something like having a view behind the navigation bar and removing the borders (see here for customisation examples).



来源:https://stackoverflow.com/questions/48102678/cant-change-navigation-bar-height-ios-11

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