Just to prove I'm not going mad here's my app working, complete with a Nav Bar.
But this is what it looks like in the Main.storyboard, no Nav Bar.
I have rectified this is the past by disconnecting the link from the TabBar controller and restablishing it. I want to be able to edit Nav Bar as I seem to have two back buttons. One comes up and < and the other as < Back, shown top.
What's the fix and have I created the View in the wrong order?
Many thanks.
Here's an image of where to go if you need a navigation bar in a View Controller.
If you need to add Bar Buttons, you can use a Navigation Item as well.
Related
After selecting a view as in the first screenshot below, either collapse a view or clicking somewhere else to lose its focus will make the bar automatically scroll to the top as in the second screenshot. Is this a bug of Xcode? If not, how can I get rid of this bad behaviour?
Thank you
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.
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
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.
I'm building my iphone app.
I've got a problem. For every view without the Navigation bar and the Tab bar is pulled up of 20px.
So I have to place every elements 20px below the top edge.
In this screenshot http://ge.tt/4FG1fJ9 you see the Interface builder view, with 20px bar space at the top, and the result into the Simulator.
This solution works, but give me some problems, and it's not elegant.
I'm wondering why all this happens.
Have you got any idea?
Thanks
In Interface Builder, open your xib, click on the root UIView and then hit Cmd-1. That will bring you to the UIView Attributes window. There are a few drop downs for "Simulated UI Elements" and you can set the Status Bar to Black (or whatever the option is). This doesn't add the status bar to your view, it just simulates the size of the status bar so that you can layout your views without having to shift everything down by 20 pixels.
This is a common problem that seems to rear it's head in different ways. The cause, though, usually has to do with poor coordination of the status bar.
I was able to reproduce the problem just now in a test app by adding a 'Status bar is initially hidden' line to my Info.plist and setting it to YES. The app looks fine in the main view, but if I push a new view controller and then set the status bar to display, the new view appears shifted down 20px. That is, the top of the view appears 20px below the bottom of the status bar.
I know that's not a terribly specific answer, but take a look at how you're hiding/showing the status bar in your app, and also how you have the simulated status bar in your .xib files set.