UISearchBar increases navigation bar height in iOS 11

后端 未结 19 1572
醉酒成梦
醉酒成梦 2020-11-28 02:47

I have my UISearchBar being part of the navigation bar like:

 let searchBar = UISearchBar()
 //some more configuration to the search bar
 .....
         


        
19条回答
  •  日久生厌
    2020-11-28 03:08

    All you have to do is to subclass UISearchBar and override "intrinsicContentSize":

    @implementation CJSearchBar
    -(CGSize)intrinsicContentSize{
        CGSize s = [super intrinsicContentSize];
        s.height = 44;
        return s;
    }
    @end
    

提交回复
热议问题