iOS 7 | Navigation bar / Toolbar buttons very close to status bar

前端 未结 6 991
太阳男子
太阳男子 2020-11-29 17:49

I have a problem when dragging a navigation bar or toolbar (storyboard) to my view controller.

UINavigationBar:

6条回答
  •  遥遥无期
    2020-11-29 18:17

    You can resolve this issue by using Auto Layout, as per this techincal note (Preventing the Status Bar from Covering Your Views).

    Here are some excerpts:

    Add the Vertical Space Constraint to the top-most view

    • Control drag from the UIToolbar to the "Top Layout Guide"
    • In the popover, choose "Vertical Spacing"
    • Change the "Vertical Space Constraint" Constant to 0 (zero)

    If you have other subviews below the UIToolbar, anchor those views to the toolbar instead of the Top Layout Guide

    This will support ios6 and ios7.

提交回复
热议问题