I've created MyViewController in separate xib and pushed it to navigation stack. It is loaded properly and resizing, but hides below the displayed navigation bar (green button hidden):
In the xib I've set all options of top bar to inferred:
How can I solve it? Of course I can manually add spacing in the xib, but it's just not the right way.
EDIT:
In xib's attributes I don't see extend under Top Bar tick, since in xib I have created UIView with file owner set to MyViewController.
It is because of translucent. You should do this.
self.navigationController?.navigationBar.isTranslucent = false
And you'll see it works. When the navigation bar is not translucent, xib can't locate behind the navigation bar to show what it has.
I've managed with changing edgesForExtendedLayout property programatically in viewDidLoad:
self.edgesForExtendedLayout = UIRectEdgeRight | UIRectEdgeLeft | UIRectEdgeBottom;
With some help from question:
How to set UIViewController "extend edges" properties
Select your View in xib and the go to attribute inspector
and select top Bar as shown in screenshot and then design your screen accordingly. It gives you an idea about how much space will your navigation bar take.
Related
In every app I see the status bar colour is same as navigation bar item but in Main.Storyboard I add Navigation bar and webview and a Tab bar in the bottom. I thought the status bar will change the colour it self but it doesn't do that. Look at the screenshots:
So how do I do it? I will be really thankful for that.
You have added NavigationBar from the controls to your ViewController ie the reason it is looking like this.
To solve the problem remove that NaviagtionBar from your controller and embed the NavigationController to embed to NavigationController follow this steps.
Select Your ViewController.
Go to the "Editor" menu and select "Embed in" inside that select "Navigation Controller". So it should like Editor->Embed In->Navigation Controller.
Edit: To change the color and title pragmatically add below code in viewDidLoad.
navigationController.navigationBar.barTintColor = [UIColor redColor];//Set your color
//To set title
self.navigationItem.title = #"YourTitle";
From the link you posted to the screenshot, looks like you need to keep the uiview "Status bar View". One thing you can do is to extend the top constraint for the Status bar view should have a value of zero with "Constrain to margins" unchecked in the Add new constraints pop up in the storyboard designer. Something like
Notice that the top constraint is with Superview and not with Top Layout Guide
My ViewController is embed in a UINavigationController. I have a translucent bottom bar (toolbar), and I want my ViewController to expand under the toolbar.
I checked Under Bottom Bars in Storyboard, in both the UINavigationController and the ViewController. But the ViewController still don't extend under bottom bar.
Any Ideas ? Thanks
That is the normal behavior. If the UIViewController's view would extend below the bottom bar, that portion would be inaccessible to the user. I suggest you add a semi-transparent view to the bottom instead of the default bar, in your case.
I have read on the forums about this property, mostly its people setting this this property to false or unchecking it in the storyboard.
I have done this myself because when I have a UINavigation Controller embedded in a View, the top bar pushes my UITextView down so the text starts editing at the bottom.
Unchecking Extended Edges Under Top Bars in the StoryBoard in the UIViewController solves my problem but I don't understand what is going on.
Can someone give an explanation on what the purpose of this property is, I would like to know more about it.
By default, UITableViewController's views are automatically inset in iOS7 so that they don't start below the navigation bar/status bar. This is controller by the "Adjust scroll view insets" setting on the Attributes Inspector tab of the UITableViewController in Interface Builder, or by the setAutomaticallyAdjustsScrollViewInsets: method of UIViewController.
For a UIViewController's contents, if you don't want its view's contents to extend under the top/bottom bars, you can use the Extend Edges Under Top Bars/Under Bottom Bars settings in Interface Builder. This is accessible via the edgesForExtendedLayout property.
Reference: Why does UIViewController extend under UINavigationBar, while UITableViewController doesn't?
See the images below:
I set 44 height red topview and 44 height red footview of tableview.
UIRectEdgeTop: The top edge of the rectangle.
UIRectEdgeBottom: The bottom edge of the rectangle.
The edgesForExtendedLayout property, together with the extendedLayoutIncludesOpaqueBars property, determines whether or not view controllers' views underlap top and bottom bars (navigation bar, toolbar, etc.)
I am trying to add a tabBar to my TableViewController but it is not a the bottom it just act like a cell
Here is a screenShot:
When using a UITableviewController storyboard scene, every Tab Bar or Toolbar you drag in it is automatically put into the tableView tableFooterView.
If you don't want that, you have to create an UIViewController scene. You will therefore be able to drag your Tab Bar or Toolbar in it, set its auto layout constraints and then add your UITableView in the UIViewController scene (see image below).
However, there is another solution. Select your Navigation Controller scene and go to the Attributes Inspector. In the Simulated Metrics, go to Bottom Bar and select "Translucent Tab Bar" or "Translucent toolbar". Then, select your UITableviewController scene and repeat the previous operation (see the picture below).
If you do so, all controllers following your Navigation Controller will have a Tab Bar or Toolbar (that's another problem that can also be fixed).
Use autoLayout to pin it to the bottom
I make a toolbar in my view but I can not see it.
I use Reveal.app to check out the structure of the view
I find out the toolbar exists and it's
below the view so I can not see it. How can I fix this?
Of course I use
self.navigationController.toolbar.hidden = NO;
And these my screenshot:
Thank you in advance.
The Navigation Bar you have at the top pushes all of the content 44 points down.
In you storyboard or .xib file, you should select the view for this controller and set the top bar property to Navigation Bar. This way you will be able to work in interface builder and your content will be positioned properly.
Good luck!
Edit
Select the your ViewController in Interface Builder:
In the Inspector pane in Xcode change the Top Bar value
Open your view's .xib file and select your main view of this viewController. And then choose the Attribute Inspector on the right. And in Simulated Metrics, there has an item named Top Bar. Set your top bar into Navigation Bar instead of none. I thank that will help you.