I am working on an application that uses a UINavigationController. The root view controller of my navigation controller is performing a search similar to the Email Application. When I press on the Search Bar I hide the NavigationBar. While I display the results, my Navigation Bar is still hidden, and when I tap on one of the results I want to push a new view controller on the stack. The problem is that if I make the Navigation Bar visible it animates really funny, falling from top. I want it to act exactly like in the Email app, to come naturally from the right, already placed on top of my pushed view controller. And, when I press back I want to present my root view controller in the same state:with the search bar "over" the navigation bar. I hope I am making myself as clear as posible.
Thank you!
Related
I have a view setup inside a UINavigationController. The Blue Warning Bar displays over the top of the NavigationController's NavBar. In another part of my project I have another UINavigationController setup inside a UITabController. The NavBar allows enough room for the Blue Warning Bar to display without an overlay.
What am I missing? How can I prevent the Blue Bar from overlaying the NavBar?
Blue Bar of Shame
I figured it out!
Here is what was actually happening:
I have a View Controller inside a Navigation Controller. This View Controller contains a list of “Appointments”. When the user taps on an “Appointment” the application segues to a detail view that uses a Tab Bar Controller with five tabs, each of which have their own Navigation Controller. The first tab has an address field that allows the user to launch a Navigation App (Apple Maps, Google Maps or Waze) by tapping on it.
After opening the Navigation App, if the user returns to my application while the navigation app is still open and they did not provide the proper permission to suppress the Blue Bar of Shame, then the Blue Bar of Shame is displayed above my Navigation Bar, as it should be. If they then tap the back button to dismiss the Tab Bar Controller and return to the original Navigation Controller, the Blue Bar of Shame is overlaid on top of the Navigation Bar.
I'm not sure if this is a bug with UIKit or not.
What I did to work around this:
I changed the manner in which an Appointment List selection opens the selected Appointment's Detail. I was using a simple segue. For some reason when navigating back to the Appointment List view from the Appointment Detail, the Appointment List view's Navigation Bar was not accounting for the expanded status bar when the Blue Bar of Shame was displayed. I ended up completely replacing the rootView, which was displaying the Appointment List, with the Appointment Detail Tab Bar Controller. When transitioning back, I do the same thing in reverse - replace the Appointment Detail with the Appointment List; this seems to have alleviated the rendering problem.
I then created an extension for UIWindow to emulate the default navigation style transition during the rootView replacements.
Ok so I have a tabbar iPhone application. The tabbarcontroller contains about 5 view controllers that are each embedded in their own navigation controller with the exception of 1 in which I just added a navigation bar in IB for a consistent look throughout the app. On every navigation bar in the app, I want a rightBarButtonItem that will open up the same modal view controller no matter where it is selected from. Similar to the "Now Playing" button in the music app, I want the button to stay on every navigation bar regardless of which tab I'm on or how deep I navigate into a navigation controller. How would I go about doing something like this? Is there some way I could simply apply the button to every nav bar in the same way UIAppearance can apply an image to every nav bar in an app? Thanks in advance for any ideas.
A simple approach would be to create a base view controller from which all your other view controllers extend.
With this in place, you could set up a UIBarButtonItem in the viewDidLoad method that attaches itself to the navigation bar and listens for events. From there, it would be quite easy to observe events and present either a modal view controller or push the appropriate view controller on to the navigation stack.
I use this approach for a "logout" bar button item that presents the login view controller when tapped as a quick alternative for users to sign out of their account.
The only down side to this is that each and every view controller that inherits from the base view controller will have the logout button in the navigation bar. Should you need other buttons or want to hide the default button, you need to replace it with another button instead.
It's a quick and easy approach and is also quite simple to remove if required as you can just change the header file to reflect the inheritance rather than sifting through several view controllers removing every instance of the button. It's also easy to maintain as you could overload the button target in any subclasses to perform different functionality when the event is fired.
I am using storyboard, navigation controller in iPhone application. Then navigate it to another view where I have used Tabbar controller. Then in Tabbar controller, I've 3 tabs and each of them have their separate navigation controllers.
Now, After completed process. But when I navigate to Root, it does back with its own navigation controller inside of Tabbar controller.
Actually, I want to come back on main Navigation Controller of an application where application starts.
Basic Flow :: Main Window -> Navigation Controller -> Tabbar Controller -> Navigation Controller -> Button..
So by clicking on Button -> Back to Main Window... Any Idea to back to main root view.
But I'm stuck with this issue for navigation controller that can't back me to the application root.
Can anyone solve this issue?
Please tell me ASAP.
Thanks in advance.
Not really the answer you're looking for, but FWIW:
You should avoid hiding tab bar controllers inside other controllers so that the tab bar controller appears and disappears. This isn't how they are meant to be used. They're supposed to be a main part of the UI and if I see a tab bar controller I expect it be there at the heart of the UI, controlling access to the main parts of the UI, and visible pretty much all of the time if not all of the time.
Don't take my word for it, listen to Apple:
Appearance and Behavior
A tab bar appears at the bottom edge of the
screen and should be accessible from every location in the app. A tab
bar displays icons and text in tabs, all of which are equal in width
and display a black background by default. When users select a tab,
the tab displays a lighter background (which is known as the selection
indicator image) and its icon receives a blue glow.
Don't be terribly surprised if your app gets bounced from the app store for ignoring the human interface guidelines!
It's resolve with ::
[self.parentViewController.navigationController popToRootViewControllerAnimated:YES];
Enjoy coding..!!
I have an iphone app consisting of a tabbar controller in the main.xib, where the tab bar controller contains navigation controllers, which are associated with corresponding view controllers. I assume this is pretty standard.
If I present a modal view controllers view from a navigation controller contained in this hierarchy, the view owned by this view controller pops up as you would expect. However, Ive noticed if I have controls (such as a button) at the very bottom of this 'modally presented' view it is rarely detecting taps. It seems as though the tabset underneath is blocking the touches. Note that when I present the modal view controllers view it fills the visible screen, it isn't sliding up from underneath the tab set.
I thought this tababar controller->navigation controller hierarchy was pretty standard, shouldn't I be able to present a modal view controller from a navigation controller in this set up without issue? I have also tried to present the modal view controller from the tab bar controller, with the same effect.
How do I present a modal view controller in an app with the tabbar controller->navigation controller hierarchy such that the lowest portion of that view can detect touches?
thanks for any help!
Check out the first answer by Harry, I believe this set-up is related to your situation. Post an update and let us know if this helps: UIView doesn't resize to full screen when hiding the nav bar & tab bar
Also, what code are you using to present the modal view?
I'm working on an app that requires a pushing a view that is full screen and shows/hides status, navigation and bottom toolbars on tapping of the central image. The app currently has a UITabBarController that has a UINavigationController for each tab. Basically when the full screen view is displayed I want it to to work like the photos app and animate off the tab bar to show my full screen view.
I'm having trouble making the view take up the full screen if I manually animate out (down) or hide the tabbar.
So, in a nutshell, my question is - what is the view hierarchy of the photos app?
It must have a base navigation controller, that contains a tab bar controller. But does each tab contain another navigation controller? But if so, how to they seem to share the navigation bar with the root navigation controller (look at how the back buttons etc are animated in)?
Is there something really obvious I'm missing?
Thanks for any help.
Have you tried using UIViewController's hidesBottomBarWhenPushed property?