UISearchbar squished in UINavigationbar - ios

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

Related

Transparent Navigation bar becomes solid colour when scrolling to bottom

I have a tableview controller which has an embedded navigation bar. I managed to make my nav bar transparent. Now I am trying to achieve a solid color nav bar when I scroll towards the bottom of the table view. I am relatively new to iOS development. So please answer accordingly. I have no idea about scroll views either. I am not sure if I need to add a scroll view or not. If I do, where do I add it? Above the tableview or below it?
Here are a few images of what I want to achieve:
Image 1: Transparent nav bar, but bar button items are visible
Image 2: Transparent nav bar becoming white, bar button items' color changing from white to red
Image 3: This is the final image, where nav bar becomes white and bar button items become red.
If we scroll back up to the top, everything goes back to being the way it was at the start.

Right bar button is clickable outside of Navigation bar

I am adding a right bar button in navigation bar but when i click out side of navigation bar as shown in picture below it get pressed i don't know why it is behaving like this. I have added this button from storyboard.

Changing text color of individual bar button items in navigation bar

I have two bar button items placed in the navigation bar, but I want to change the text color of one to show whether its enabled or disabled. I've seen a lot of solutions for changing the text color for all navigation bar button items, but nothing for one specific bar button item. Most solutions on SO seem to be deprecated for iOS7 and iOS8. Any tips?

UISearchBar and UINavigationBar from navigation controller disappearing when searching

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

iOS: Move the, go back to "More" tabs, button into my own Navigation Bar

I have more than 5 tabs, so the "more" button appears and works fine. However, when I open up one of the tabs from the more menu, there is an extra navigation bar at the top, which shrinks the available space in my app.
I want to move or re-implement the "more" button (at the top of the
page) into my existing navigation bar for each tab. How do I do
this?
Here is an image of what i have now, and what I want is to move that "More" button into the space where it says "Here instead", so that I can hide the upper black bar. If it matters, I am using the storyboards.
You will need to hide the navigation bar, and then create your own button on your tool bar that will pop to the root navigation controller.
To hide the nav bar:
[myTabBarController.moreNavigationController setNavigationBarHidden:YES animated:NO];
It looks like in order to recreate the left arrow from the navigation bar in your tool bar, you will actually have to use an image and set that as the view of your toolbar item. There is an image you can use here.

Resources