Position of navigation bar for modal view - iOS7

前端 未结 8 2117
南笙
南笙 2020-11-29 18:08

In a navigation controller, you automatically get the correct colour and position of a navigation bar as expected.

like this

相关标签:
8条回答
  • 2020-11-29 19:04

    I created a Navigation Controller, deleted the "Root View Controller" that appeared with it. Then hold ctrl and drag the "Navigation Controller" on your View (delete the navigation bar you added manually before). Set the Navigation Controller as "Initial View Controller" and it works fine for me now.

    0 讨论(0)
  • 2020-11-29 19:12

    The best way to overcome this in iOS 7 is by conforming to the new UIBarPositioningDelegate protocol.

    You connect the delegate of your NavigationBar to your view controller (set your view controller as the delegate for the navigation bar either through storyboard or through code) and conform to that protocol and by implementing the method

    -(UIBarPosition)positionForBar:(id<UIBarPositioning>)bar { return UIBarPositionTopAttached; }

    You can remove the top gap in the view controller. You need to place the bar 20 points below the top edge

    0 讨论(0)
提交回复
热议问题