Strange UISearchDisplayController view offset behavior in iOS 7 when embedded in navigation bar

前端 未结 9 959
难免孤独
难免孤独 2020-12-14 03:13

I am building an iOS 7-only app. I am trying to set a UISearchDisplayController into the navigation bar.

I have it set up like this: In the storyboard, I added a \"

9条回答
  •  伪装坚强ぢ
    2020-12-14 03:25

    I had very similar behavior happening. For me, the solution was to uncheck Extend Edges Under Top Bar in the storyboard settings for the parent view controller (I've turned off transparent navbars, not sure if that effects anything). If you're not using storyboard, you have to set [UIViewController edgesForExtendedLayout].

    From the Apple docs:

    This property is only applied to view controllers that are embedded in containers, such as UINavigationController or UITabBarController. View controllers set as the root view controller do not react to this property. Default value is UIRectEdgeAll.

提交回复
热议问题