Xcode tableview hidden behind navigation bar - xcode

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

Related

How to move View Controllers on the Storyboard?

How can I arrange View Controllers on a Storyboard in Xcode's Interface Builder? When I try to select a View Controller, the mouse pointer grabs a view inside it instead.
Well, it wasn't obvious, at least for me. You should drag the white bar above the View Controller (the bar that contains the First Responder). It works even on low zoom levels!

iOS (Swift) - Tabbed navigation on view controller

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.

iOS TableViewController Scrolling away content and navigation bar under status bar

I'm using a TableViewController and I've added my own navigation bar on top to match the other tabBar pages that I have.
I had to place at the top an empty view to lower the starting point of the table view so it wouldn't cover my navBar, which was already annoying.
Now it looks fine except that when I scroll up my list both navBar and TableView go under the status bar.
I want my navBar to stay where it is and the TableView not to go under the status bar when scrolling.
For starting I can't add any other stuff in my scene if not under the table view and i get that that's causing the nav bar to follow the tableview up so that's part of the problem..
Xcode 7.1 swift 2.0 iOS 9
When creating this kind of structure (table + other elements), the best approach is to actually have a ViewController that contains a TableView and additional elements (like your navigation). Do not try to put elements, that are not part of the table itself inside the table.
Here is an example of the structure, where I have intentionally coloured the custom view (in your case the navigation) orange. As you can see, it is outside the table. This way the showing and scrolling of the table is completely separated from the other elements.
you can try self.edgesForExtendedLayout = UIExtendedEdgeNone;

Can't get the most basic scrollview to work

This is not my day. I've just deleted every object from my previously completed view controller to start over because I can't get a simple scroll view to scroll. I've got a view controller that is embedded in a navigation controller. I put scroll view inside the view controller and then put two text fields inside the scroll view, one field at the top and one at the bottom.
First of all, when I run this, it won't scroll. What is the point of the scroll view if it won't scroll?
Second, I can't figure out how the relationship between the navigation bar and the scroll view works. Is the scroll view behind the navigation bar? Is it below the navigation bar? In the story board, it looks like it is behind the bar, but when I run it, my text field is pushed down so far that it looks like it is behind it.
Here are a couple of screen shots. To say that I am frustrated is an understatement. Thanks for any help getting me out of my circular problem. I appreciate it.
And here is how it looks when I run it. Notice how far down the top text field gets drawn. Also note that you cannot see the bottom text field. I am unable to scroll to this. What gives?
First of all, when I run this, it won't scroll. What is the point of the scroll view if it won't scroll?
Scroll views won't scroll by default unless their contentSize exceeds their bounds. You can force it to scroll anyway by setting alwaysBounceVertical to YES.
Second, I can't figure out how the relationship between the navigation bar and the scroll view works. Is the scroll view behind the navigation bar? Is it below the navigation bar? In the story board, it looks like it is behind the bar, but when I run it, my text field is pushed down so far that it looks like it is behind it.
Yes, in iOS 7, by default, a scroll view will start at y = 0, behind the nav bar. You use the contentInsets property to push it down. The view controller has an automaticallyAdjustsScrollViewInsets property that can handle this for you.

Incorporating navigation bar in UIViewController in Interface Builder

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.

Resources