Is there any way to fix the position of a UISearchBar + UISearchDisplayController? - ios

I have a ViewController nested inside a PageViewController which is also nested inside a NavigationViewController.
The thing is I have put a UISearchBar and UISearchDisplayController item on the center of my ViewController and for some reason, when I click on the search bar and the keyboard appears, the UISearchBar goes up to where the NavigationBar is. Also, when I click outside the UISearchBar, it dissapears with a fading effect.
Could someone explain to me what is going on? How can I fix the position of the UISearchBar so that it does not go up?
I tried a similar UISearchBar and UISearchDisplayController on an empty project with a single ViewController and the UISearchBar does not dissapear and does not move up. From this I believe that for some reason the UISearchBar moves up in the presence of a NavigationBar, which acts like a magnet.

Related

when UIsearchController searchbar become active there is a gap showing in the place of statusbar

In my UIViewController One UITableView showing list of items, I added UISearchController in the UIViewController not in UITableView.tableHeader. and add another result UITableViewController for showing the results. And added the property hidesNavigationBarDuringPresentation=yes;
to UISearchController.
But my problem is when I start to search the There is a gap between UISearchController and the top of the screen, UISearchController is not expanding the height. My UISearchController.searchBar is like this
but I need like the image given below
Could you please Help me,
Thank you.

TableView Scrolls Over NavBar

When I scroll my TableView, it scrolls over my navigation bar (which I made without using the built in navigation bar for various reasons). See below:
Unscrolled:
Scrolled up:
How do I make it so that the TableView scrolls under the Navbar?
SOLVED:
I checked the "clips subviews" box for the table view to fix this problem.
To me, it looks like there may be an issue with your view hierarchy. Now, I assume that you built your own navigation bar by subclassing UINavigationBar.
In order to get the kind of behavior you need, you should have the following:
UIWindow's rootViewController is an instance of UINavigationController.
UINavigationController.navigationBar = your subclass of UINavigationBar.
UINavigationController.viewControllers[0] = UITableViewController
The UITableViewController.view = your UITableView

UISearchController misplaces UISearchBar

I am using the UISearchController on a modal page to allow a user to search some data. The page uses a table view controller design and the searchBar is in a tableViewCell.
When the user taps on the searchBar, the UISearchController animates the layout to slide the table header to the top of the page and moves the searchbar. However it does not end up in the right place. It does not move sufficiently up.
Anyone have a suggestion on how to help the UISearchController to position the searchBar correctly?
Before tapping the search bar (looks ok)
After tapping the search bar (search bar in wrong place)

UIPopoverController passthroughViews ignoring Z-index and hierarchy?

With iOS7 tables has extended edges that lies under navigation bar, tabbar, etc. When I presenting UIPopoverController from one of cells of that table and set that table in the passthroughViews, it causes possible to tap on the cell under navigation bar, toolbar, tabbar, whatever! Even if bars are upper than tableview.
When I confronted this with UISearchBar, I've set up passthroughViews like that
#[self.searchBar, self.tableView]
(no matter that searchbar is in tableHeaderView) and everything was working fine (I thought). But now I know it's definitely an unexpected behaviour, possibly a bug in Cocoa Touch.
Have anyone solved this?

UIButton stays highlighted until UITableView ends scrolling

I have my own custom navigation controller(that subclasses UIViewController) that has a stack for the view controllers. It has a custom navigation bar and a content view, where I add the view of the view controller at the top of my stack of view controllers.
Then navigation bar, which is a subclass of UIView, I didn't subclass UINavigationBar, because I don't need to, has a Back button, and another button which at this moment doesn't have any action connected.
My problem is that if I scroll a UITableView (that belongs to the current view controller on the stack) and I press either on my back button or on the other button, both of them stay highlighted until the UITableView ends scrolling. It's the weirdest behavior ever, and I don't understand why it happens.
Any suggestions please?
Apparently, if I call [button setHighlighted:NO] on my IBAction it de-highlights it even if the UITableView is still scrolling

Resources