UISearchController doesn't work properly with a non-translucent UINavigationBar

后端 未结 5 827
走了就别回头了
走了就别回头了 2020-12-16 11:16

Currently I am trying to embed a UISearchController into my application. But the UISearchBar, which is a property of the UISearchController, doesn\'t get displayed properly,

5条回答
  •  一生所求
    2020-12-16 12:04

    It's clearly a bug (rdar://20942583).

    My workaround is to set

    self.edgesForExtendedLayout = UIRectEdgeAll;
    self.extendedLayoutIncludesOpaqueBars = YES;
    

    This allows you to keep the navigation bar opaque. The downside is that the content flows below the bar even if it can't be seen, creating some overhead.

提交回复
热议问题