UISearchBar clipped under status bar when added to UISearchDisplayController

后端 未结 2 1593
旧时难觅i
旧时难觅i 2021-02-14 03:52

I want my search bar to draw its background extended upwards below the status bar like this:

\"enter

相关标签:
2条回答
  • 2021-02-14 04:36

    I was having the exact same issue, but forcing clipsToBounds to YES for the searchBar, did the trick. No need of auto-layout nor UIBarPositioning protocol methods.

    0 讨论(0)
  • 2021-02-14 04:47

    You conform to the UIBarPositioningDelegate protocol and upon properly becoming the delegate for your SearchBar, implement the delegate method as such

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

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