iOS 7 Status Bar Collides With NavigationBar

前端 未结 17 1322
攒了一身酷
攒了一身酷 2020-11-28 03:14

I have a view controller in my app that has a navigation bar dragged on it in the storyboard. It was working fine in the iOS 6 but in iOS 7 it look like this:

17条回答
  •  盖世英雄少女心
    2020-11-28 03:48

    you can simply do this:

    1) add a constrain between the Navigation Bar and Top Layout Guide (select navigationBar, hold ctrl key and go to Bottom Layout Guide, unhold ctrl key)

    Add vertical Contrain

    2) select vertical spacing:

    vertical spacing

    3) set constant to 0:

    vertical spacing constant

    Result:

    result

    UPDATE

    In your AppDelegate file you can add this:

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool 
    {
      // Prevent Navigationbar to cover the view
      UINavigationBar.appearance().translucent = false
    }
    

提交回复
热议问题