iOS UISearchbar in UIToolbar, show search result not popover in iPad - ios

I'm use iPad UISearchbar embed in UIToolbar, the search result will show in the UIPopover
but use iPhone, it's show in same table view
I want to search result show in the same table view, How can I do?
Thank You!

I had the issue too. What I do to fix it is instead of adding a UISearchBar in the UIToolBar via a UIBarButtomItem, I added the UISearchBar in a view (normal UIView) and added that view in the toolbar via the UIBarButtomItem. See the image below.
I don't know why, but this fix the issue.

Reload the TableView with Sorted items. Thats it.

Related

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.

SearchController issue in UITableview

In my code i added UISearchController as UITableView Header.
But if User scroll UItableview then searcher is goes up & hide.
I want to show UISearchBar stick to top.
I don't want to add it in navigation title.
I also try to add in UIViewController but it is disappear when try to search something.
Please help me to solve this.
Thank you,
Don't put the UISearchBar in the header of the UITableView. Put it outside the UITableView. It just means that your view controller will have to subclass UIViewController instead of UITableViewController.

My UITableView Gets ShiftedDown

I have a UITableView that when first displayed it displays correctly with the first row appearing on top. When I select a cell another UITableView is presented. If I used the back button on the UINavigation Bar the original UITableView is shifted down with a blank space between the UINavigation Bar and the UITableView.
I am not using story boards. I am using XIB files. I am also using a sliding menu that I got the code for from Ray Wenderlich's web site.
When I slide back the main screen over the first UITableView it goes back to its proper position. But then when I select an entry again the issue described above appears.
I found another post that seems to provide an answer to the issue. This post says to make some adjustments like to the translucent settings or the auto-layout settings but doesn't give specifics.
Here is that post: Container View getting pushed down as if it had a UINavigationBar?
Thanks,
Glenn
Add
self.automaticallyAdjustsScrollViewInsets = NO;
in viewDidLoad, of the UIViewController where you have the shifting table view

Hide normal UITableView when using Search Display Controller

Both my UITableView and searchResultsTableView have a clear background color. How can I hide the normal UITableView when I'm typing into the search bar of the searchResultsTableView? I've tried hiding tableView, but it hides both tableviews. See my interface builder setup below:
I've also read the post here:
Hide UITableView when searchResultsTableView displayed
However, my Search Display Controller is not being added to the tableview, only the Search Bar is. So I'm not sure how to fix this issue.
Any help is appreciated. Thanks!
You can use the method [subView removeFromSuperview] in this case. Whenever there is a need to display the searchResultsTableView just remove the UITableView from the superview and add the searchResultsTableView in place of that by using method [self addSubview:searchResultsTableView]

Why SearchBar of Search Display Controller is not moving up in iOS7?

On my UIViewController, I took UISearchDisplayController and UITableView. The SearchBar of UISearchDisplayController is outside of UITableView because I don't want to scroll SearchBar with TableView. When started typing some text, It looks fine in iOS6 but in iOS7 SearchBar does not move up and tableView comes over it. And after search button clicked, SearchBar goes out of screen and whole screen messed up. Why is this happening?
Image:
I don't know if this problem is stil up to date, but maybe someone will have the same question. The reason of this is that You are using UIViewController instead of UITableViewController.
If it makes no difference to You, use the UITableViewController. If You have some reasons, you'll have to move searchbar programatically in searchBarShouldBeginEditing:searchBar
and searchBarShouldEndEditing:searchBar
Here's an example how: https://stackoverflow.com/a/8042790/1293285

Resources