close
iOSObjective CTutorial

Solution of searchDisplayControllerWillEndSearch goes out of the UIView when end searching

solution-of-searchdisplaycontrollerwillendsearch-goes-out-of-the-uiview-when-end-searching

I got this issue when I was working with searchDisplayController when I call searchDisplayControllerWillEndSearch it goes out of bound o

The Problem:

I’ve a UIView in which I’ve placed a UISearchBar and a UIButton below are the screenshots that explains the problem: 

^This is how it appears when I first run the app 

^This is how it gets when I want to enter the text 

^Finally this is the size it gets after I end the search

The most important point here is that I’m not using UINavigationBar the red is a UIView. I’ve haven’t coded anything for it’s UI, I just placed it in the .xib and set it via autoResizing. They only this I wrote for UISearchBar was [_searchBarTop setBackgroundImage:[UIImage new]]; which was just to get the background image vanished.
I’ve tried self.searchBarTop.clipsToBounds = YES; and this 
(void)searchDisplayControllerDidEndSearch🙁UISearchDisplayController *)controller

The Solution:


 

Tags : searchDisplayControllersearchDisplayControllerWillEndSearchUIView
Chaudhary Talha

The author Chaudhary Talha

I'm an iOS developer by profession and UI/UX designer by passion. All my tutorials are based on my personal experiences and whenever I learn something new I share it with the world.