Adding segment controller on navigation bar in the second row - ios

I want to add a segment controller to the navigation bar not as the title, but like this:
How can I do that?

The problem is that it looks like this uses the navigation bar's title, which is actually in the same place as where you want your segmented control to go. Instead, you need to add a "prompt" to the navigation bar to increase the height of the bar, and add the prompt text above the content area of the bar.
This can be done purely in Interface Builder as illustrated by the screenshot below, or programmatically using the following code:
[self.navigationController.navigationItem setPrompt:#"some prompt text"];

I've had to do the same and simply added the segmented control inside a view added under the navigationbar bottom.

Related

Status bar does not inherits Navigation bar colour iOS 10.2 Objective C

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

Remove the gray bar at the bottom of view controller - iOS

The image shows the View controller and the bar I want to remove. And also the structure of the view controller:
Someone told me how to remove the grey bar present at the bottom of the view controller as shown in the image. Unable to select and delete the bar. When I try to add the tab bar in that place, it goes behind the grey bar and becomes invisible.
What do your simulated metrics look like?
Can you get rid of the bar by changing the bottom setting?
Couple of things - if you are using autolayout, just make a constraint to the bottom of the container, with 0 value for the constraint. That will take it to the bottom. Second thing I would add is a zero size table view footer to the tableview.
This is a toolbar that comes with the UINavigationController that the View Controller is embedded in. Assuming you have a Navigation Controller on the storyboard connected to the view controller, select it and in the attributes inspector deselect "Shows Toolbar". If you want to do this in code you can get and set isToolbarHidden on a UINavigationController instance.

How to design a tabbar inside a view

I need to make this view:
A view on top of the tab bar with some data. (image, name, text, ...)
tab bar has a 3 page and every page has a separate view
When user scroll up, tabbar will be scrolling top of the page and a UILable stands top of tab bar. It can be show with some fading animation (not important right now)
this is after scrolling:
I search in cocopods but I didn't find solution.
---- EDITE
I want to know how to put uitabbar inside a view. Is it possible ?
If yes, How to change just sub view of tab bar when I change tab bars!
I want to know how to put uitabbar inside a view. Is it possible ? If yes, How to change just sub view of tab bar when I change tab bars!
Yes, but I wouldn't describe the thing you are showing in your screen shot as a "tab bar". It is a UISegmentedControl. So all you have to do is respond to the user tapping on a segment of the UISegmentedControl by substituting one view for another, and that's easy to do.

Bar Button Item is not Showing

I am trying to create a bottom toolbar. So I dragged I Bar Button Item to the View Controller and it was automatically position at the bottom, see image below:
But when I run the app, it doesn't show the bar at the bottom.
I already added:self.navigationController?.navigationBarHidden = false
I think it's just only a constraints problem.
First of all check your Document Outline near to the left of your table, to see the position (toolbar is just below table):
Add your constraints and pay attention to all options as shown in the picture:
Then, take a look to the size inspector, for the table view:
And for the toolbar:
This configuration working both in portrait/landscape mode.
Drag UIToolbar controller directly instead of only UIBarbutton item.
self.navigationController?.navigationBar.hidden=false
Have you set constraints of UIToolbar? I just guess it can be one of the reasons why you cannot see your barbuttoitem.
The navigation bar and the toolbar are two different things and the toolbar is hidden by default. Try setting the toolbar hidden attribute to false.
Sometimes bar button item and bar button do not show when we present our screen. On screen we can then not see bar button item and bar button. So we need to push our screen if we want bar button item and rightBarButtonItem.

NavigationBar hides View while runtime but not in Interface Builder

I set up a tableView with the Interface Builder and put a red View above the TableView like this:
But while runtime the red View gets hide by the Navigationbar, so i have to set a constraint with Autolayout like this:
But that can not be correct...what i´m doing wrong?
More Information which my help:
This is because iOS7 allows views to be displayed beneath it. You need to use an offset to push the view down below the navigation bar like you are doing. You could also set the navigation bar to not allow items beneath it by unchecking
under top bars
If you use xibs instead of storyboard add this into your view controller.
self.edgesForExtendedLayout = UIEdgeRectNone;

Resources