I'm using Xcode 4, but not Storyboards
We have a navigation controller instantiated in the app delegate.
When we create view controllers with Xibs the xibs are views that are the height of the iphone (without the navigation bar). Putting content in this area is deceptive as there is actually 44pt's less space (the height of the nav bar) which gets put there by the navigation controller.
Therefore how do we remove the room where the nav bar should be in interface builder?
I can click the view and then change the "top bar" to "navigation bar" which will work, but I cannot add bar button items to this navigation bar, which makes me think that this is not the correct way to do it.
Can anyone let me know what the best way to do this is?
Many thanks
When you push your controller or use it to init the navigation controller, the navigation controller should take care of resizing at run time. The area in IB where you set the top bar is under the heading "Simulated Metrics" and is meant to give you a preview of what your selected interface elements will do to your available display area. The "Simulated" part is why you can't put items into that bar.
The real navigation bar should be configured wherever the navigation controller is defined, whether in code or a xib.
Related
So, My problems lies with the tabbed navigation bar (The bottom navigation bar with icons). Is there a way to make this static so that it shown on all view controllers/ screen, including ones that do not contain a main link.
If you check the image below, I have a view controller connected to tabbed navigation bar that displays that view controller icon. I then have another view controller connection to that view controller, and I would like to make the tabbed navigation bar show on this ...
Is this possible to do? I'm not sure if it requires code, or just adding a few things to the storyboard. Any advise would be appreciated.
Many thanks in advance!
The Storyboard of my application (I'm not important enough to embed images just yet :( )
As long as you are presenting the View Controllers with the "Push" method, and not the "Modal" method, the tab bar controller should stay at the bottom of the screen.
I have added a bar button item in my app and it is only visible on the storyboard when it is selected , it is not visible at all when I run it on the simulator or real device, any ideas of how I could solve this? thanks !
The problem is that you are already in a UINavigationController interface. Thus, adding your own navigation bar to this view controller won't work; it is hidden behind the navigation controller's navigation bar. What you want to do is modify the navigation controller's navigation bar. You do that by adding a navigation item to this view controller, not a navigation bar.
Can anyone please tell me how to fix the following issue.
I am building an iPhone app using Storyboard. I have a Navigation Controller as root view and off that a view controller. On this I have a few buttons that when clicked takes you to a table view controller. All fine and well, but when I link the buttons to their respective table views, the top navigation bar obscures the top cell in the table view controller.
Does anyone know why this is happening and how I can fix it?
Also it seems to have thrown off my layouts from the view controller from which they inherit.
See attached image for a better explanation perhaps.
I believe this is the intended behavior when using the translucent navigation bar. It's semi transparent specifically so that you can see items pass behind it (e.g. a table scrolling). If you don't want this, changing the navigation bar's style to opaque should solve the problem.
Since I wanted to keep the translucence, I just added a UIView between the navigation controller and the prototype cell (width of the view, height 60). That way the first cell in the table starts beneath the navigation bar but I can still see the scrolling underneath.
This is a bug/feature in IB when you use a translucent navigation bar, the content view runs under the navigation bar. For non transparent bars the content view begins after the bar. If your content view is a UIScrollView (UITableView is a descendent of UIScrollView) the content will be automatically scrolled so as to not be hidden under the navigation bar. So the problem only exist in IB when you run the app everything should be ok.
You just need go to the Navigation Controller properties, then Simulated Metrics, and change the Top Bar to be a Transluscent Navigation Bar WITH PROMPT. And that should be it. No need for that extra UIView
So my problem is that I would like to add a Tab bar to my existing Master View.
Also My search bar won't stay on top.
Here are some images of the storyboard
I hope I've understood your problem.
Keep in mind that Tab Bar Controllers and Navigation View are also View Controllers (VC) to serve other VCs. Saying so, you have to organize your story board controllers in order to have the Tab Bar Controler as the root VC and a Navigation VC as parent of your master view in order to keep the master/detail navigation.
Safari on iPad has this bar at the top (it isn't called "toolbar" on iOS, right?), with some icons and input are for searching.
How to put such buttons and input field into Navigation Bar? Is it even a Navigation Bar? From what I read a Navigation Bar has one button on the left, another one on the right and one Label in the middle. But how to create something like that "top" bar from Safari?
If I'm in XCode 4.0 and choose "View-based app", should I then set in the ViewController > Simulated Metrics > Top Bar > Navigation bar? And how to add buttons to it?
Edit
Sorry for the confusion - I don't know if the proper way is to add to a Navigation Bar. I'm just asking for a general overview how such "top "bar" is made. What kind of View do such items belong under?
You probably don't want to use a navigation bar. They are very limited in what controls you can put in them. Try using a UIToolbar instead.
I think you may be looking for the UISearchBar
UISearchBar Sample Code
In the interface builder you should be able to just drag and drop objects onto the navigation bar, as for the little icons, those are just buttons with no border and images. Those images are preloaded in the iOS SDK, so you won't have to make them, but if you want your own then you can make them yourself.