UISearchBar and UINavigationBar from navigation controller disappearing when searching - ios

I have a UINavigationController with a UISearchBar right under the UINavigationBar. When I click in the search bar, the text and buttons on the UINavigationBar disappears, but the blank white bar still stays. I think this is because it is a navigation controller and so the navigation bar can disappear. In addition, when I start typing, the search bar disappears, but I can still type. My question: is there a way to either make the entire navigation bar disappear when I start searching or make the text on the navigation bar stay while searching, and how do I ensure the search bar does not disappear? Thanks.

self.searchController.hidesNavigationBarDuringPresentation = NO;

Figured it out. In the storyboard, I had to click on the little icon on the bottom, third from the left, then "resolve auto layout issues." Autolayout must be off for this to work

Related

UISearchbar squished in UINavigationbar

I have a search bar set as the title view in my navigation bar. In the initial view the search bar is evenly spaced in the middle with buttons on both sides. In this view the back button pushes the search bar so that it is uneven. I've tried getting rid of the text of the back button, but it still didn't work to spread the search bar out. Squished search bar image
I recently needed to solve the same issue. I ended up creating a UIBarButtonItem with the back button image asset, and setting that as the navigationItem.leftBarButtonItem. This button press then calls navigationController?.popViewController(animated: true) to pop the viewController off the stack

Can't make UITableView appear under translucent navigation bar

I'm trying to use a translucent navigation bar and want to put my table view (in a UITableViewController) under the navigation bar but without success.
I've been searching all over the web but I'm only finding help on how to push the content below the navigation bar which is exactly the opposite of what I'm trying to do.
I have Under Top Bars checked inside my storyboard.
Please help!
set
self.automaticallyAdjustsScrollViewInsets = NO
in viewDidLoad and then check

How to give automatically top space to navigation bar in ios?

I have a UIViewController. I am designing the screen for iPhone 5s. I have a UIImageView & I am giving top space to container of 20. I also have UINavigationBar at top.So the space given of 20 is not enough. UIImageView is hidden behind the UINavigationBar. I can resolve this issue by giving much space from top. But in that case at design time my UI will not look proper. So is there any way by which space from UINavigationBar is automatically calculated?
In Attribute Inspector set Top Bar to Translucent Navigation Bar like this
then set Top Space of imageView to Top Layout Guide like,
set navigation bar type as opaque Navigation Bar so it will opaque that much space from your view controller and show your view content after navigation bar space they will not hide inside of navigation bar.
but if you set navigation bar type as Translucent Navigation bar then your content will hide inside of navigation bar so set "Opaque Navigation Bar" type. no need to do any other stuff for that.
I hope it will help you!

Segmented control in Navigation bar

I need to put segmented control into navigation bar below the title and other buttons. How do I make this? Everything I found so far says you can't increase the height of navigation bar without hacks. Is it even possible?
https://drive.google.com/file/d/0B2fViGVp6nhhOEdJSU0zeWZiS1U/view?pli=1
Why don't you put both of them separately? On top navigation bar and below that UISegmentControl.
Just make sure background for UISegmentControl should be matched and aligned with UINavigation bar.
Hope that helps.

Navigation bar - why do I get borders?

I have searched but could not find a solution for this...
I have a view controller in storyboard, and I want to add a navigation/toolbar bar under the status bar with a cancel button. I can place a navigation bar using constraints, but I get unwanted borders around the navigation bar. How do I get rid of these?
Turns out that I had customized the appearance of UINavigationBar for iOS 6 and forgotten to disable that code.

Resources