Greyed tableview background even after searching is completed - ios

I am having UISearchBar in my iOS Table view application. I am able to search for words.
When I search for words, Search bar comes to front with full screen and greyed background of table view.
After searching, and clicked on cancel, still the greyed background doesn't disappear in the table view. Please see the screenshot below.

Related

UISearchController iOS 11 not in navigation bar busted?

I have an app in production. On iPad, the layout is 2 table views on one layout. There is a search bar for the left hand table view. In iOS 9/10 this worked fine- the search bar, when expanded, simply appeared in the table view. In iOS 11, the same code will make the search bar expand out of the table view and attach to the nav bar area at the top of the screen.
If I change the presentation context of the search controller, then in iOS 11 it is completely broken and does not work.
self.definesPresentationContext = YES; //YES PRESENTS SEARCH BAR IN TABLE VIEW
I have created a demo project to simplify the example, this is directly Apple's table demo with the table view made as not full screen. The presentation context can be set to either the table view or not, and the search bar scope buttons can be easily added or not.
In the demo, the search controller, when presented inside of the table view, can be tapped in order to start a search, but is completely unresponsive to any taps - the cancel button, the X to clear text, trying to move the cursor. Keyboard text entry works and it will correctly filter the items. But then you're stuck and can't exit.
Here's a link to the demo project. Am I missing something or is this an Apple bug? Majority of code in APLMainTableViewController.m.
DOWNLOAD CODE EXAMPLE at this link
Full app image:
Correctly working search in iOS 10:
Demo project screenshot with bad search controller:

Do you have to put the UISearchBar in a UITableView?

I would like to use a UISearchBar and put it towards the bottom of a screen in order to search for available names through an API call. I want to have this SearchBar as part of a sign up form. However, when I put the SearchBar on the screen where I would like through the Storyboard, it does not show up when I run the app on the simulator. When I looked up this issue, everyone is putting the searchbar in a tableview. Am I not using the correct UI element for my cause?
The reason your search bar is not on the screen is probably because you didn't set constraint correctly or it was hidden or covered by some other view.
And for your second half of the question, I myself never put a search bar on a UITableView itself. Some apps put a search bar on the first cell of a table view but you have to scroll to make it show up. I myself always prefer to put it on the navigation controller on the top of the screen so that it will always be there and ready for user to search anything.

Search display controller disappears on multiple clicks on cancel button

I have a UITableView in which i have added UISearchDisplayController on the header of the table view in xib.
When i run the project and click on search bar textfield which show cancel button. When i click on cancel button multiple times frequently then UISearchBar is disappear from the header of the table view.
You can download the sample app from below url.
https://www.dropbox.com/s/3ero6u76dceq4r7/SearchBarSample.zip?dl=0
Any help is much appreciated. Thanks!
You have taken the search bar inside tableview. Just take it out of the tableview. Search bar should be above in list. The problem will be resolved.enter image description here

Search bar's frame in UITableview header become zero

I have a table view in first view and it has search bar. From that, I select 1 cell and it will push another view. After that, I come back to my first view and my search bar frame become zero like this. As a result, I can't see search bar but I can still tap on that. In visual debugging, I can still see search bar but on device, it disappear. May I know how it happen like this?

UISearchDisplayController click-through bug on iOS7

We use the standard UISearchDisplayController in a project built on iOS 6.1 SDK. There appears to be a bug when running the application on an iOS7 device - The controller lying underneath the modal controller gets the user interaction instead of the UISearchDisplayController.
Steps to reproduce:
Click on the search bar to give the UISearchDisplayController focus (modal view is shown on top of the viewcontroller lying underneath and the search bar is moved to the top of the window)
Write something in the search field to get the table view with results to show up
Click on the clear search field icon (X) or backspace the text in the search field
Now the modal view is shown instead of the table view
At this point if the user clicks on the modal view, the click is caught by the viewcontroller lying underneath the modal view causing faulty behaviour. This problem still remains even if the table view is shown again after the user has done another search.
Has someone else noticed this bug, and has anyone a solution to this problem?

Resources