I want my tab bar to be translucent and blur the content behind it, but when I set its color to clear color it turns black instead. Currently I have my tab bar created programmatically in the app delegate. I made a class function called getTabBarController and configured my tab bar in there, and I call it in app delegate to return the tab bar. At last, I write
let vc = TabBarInitializer.getTabBarController()
self.window!.rootViewController = vc. Am I creating my tab bar incorrectly? How do I make the tab bar be on top of my content so that the translucent effect works?
You have place view or content behind tabbar which you have to show instead of black.
So when tab transparent, view behind the tabbar become visible.
Related
When using the Navigation Controller it creates a new Navigation Bar on my first view controller. Intead of that bar being at the top of my screen I would like it to be on bottom. Is this possible? If not can I switch to using a different Nav Bar?
Navigation Bars are always at the top of view controllers, and cannot be moved. You could explore a TabBar or ToolBar though, depending on what you want.
Navigation Bar always appear on the top of your UIViewController when embedded in a UINavigationController. You cannot move it to any other position.
Still if you want to achieve such a requirement,
Hide the default UINavigationBar
self.navigationController?.navigationBar.isHidden = true
Create a custom UIView of same height(44) as the UINavigationBar and pin it to the bottom of your controller.
I want my SplitViewController to be embedded in TabBarController. I started with a Single View Application. Then I used storyboard to connect all controllers as shown on this image.
The navigation works fine, but the problem is at the top and bottom bar background colour. I would like to use Translucent Black Navigation Bar and Tab Bar. For some reason, the background colour of Navigation Bar and Tab Bar in master view is grey instead of purple (colour of master view background). In detail view the colour is fine. Problem is clearly seen on this image.
I tried to manually set the colour of NavigationBar but it didn't help.
I have this ViewController as the root view controller. This VC is embed in a navigation controller. So, the navigation controller is the initial controller.
I have worked millions of times with an app like this.
If I want to add buttons to my nav bar I go to the navigation controller, turn on TOP BAR property to translucent navigation bar and now I can add buttons to the nav bar on my view controller.
But this app is different. I need a tab bar at the bottom too. So, I follow the same logic. I go to the navigation bar, turn on BOTTOM BAR property to Translucent Black Tab Bar, a black rectangle appears at the bottom of my view controller and BOOM, I cannot add buttons to it. Same logic, different behaviors.
If I try to add a tab bar to the black rectangle Xcode will not accept.
I want to add this tab bar to the bottom of the view controller and make it translucent, so the collectionView this controller has will be partially visible thru it.
So the question is: what is the purpose of the BOTTOM BAR property of the navigation controller if it will not accept dragging tab bar items to it? How do I add a tab bar to my navigation controller or to its root view controller using this stuff? Or in other words: how do I add a tab bar to the bottom of a view controller that has a collection view covering the whole are and make that tab bar translucent, so I can see the contents of the collection view passing thru...
The bottom bar of a UINnavigationController is a UIToolbar and if shown the navigation controller should automatically adjust the insets of the collectionView (and other scrollView) to make the content appear under them when you scroll.
I've encountered the problem of adding elements to that bar myself and the only way that I've found is to do that in code accessing the toolbar property of your navigation controller and set the items property with your UIBarButtoItems. As you want to make a segmented controller-like component I suggest an item with a custom view.
I can't answer the first question, but as for the second- drag a Tab Bar Controller onto the canvass the same way you would with a new View Controller. Make this new Tab Bar Controller the initial View Controller. CTRL-drag from the Tab Bar Controller to any of the view controllers (or navigation controllers) for which you want a tab bar button. Select "View Controller" as the segue type. The tab bar button for that segue will appear at the bottom of both the Tab Bar Controller and the View Controller itself, and you can change the text or image by clicking it and opening the Identity Inspector.
I embeded in a navigation controller to a viewController, and a nav bar item is showing (in the outline editor), and I can change the title, but the navigation bar is not showing in the (outline editor) and I therefore cannot change the bar tint color. So I tried adding in a nav bar programmatically, like this:
.h file
#property (strong, nonatomic) UINavigationBar *nav;
.m file
nav = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
self.nav.tintColor = [UIColor blueColor];
[self.view addSubview:nav];
And here is the outcome:
Update
Your last comment in above answer that "I made the color to blue, and it shows it blue in the storyboard" is conflict here.
I guess you are not able to set tint color for navigation bar. Because Storyboard won't show any color tint color for navigation bar, it's only visible at run time (In Simulator).
Even if you change tint color of navigation bar it still shows white color.
Lets have a look:
As "matt" said : You have to change bar tint color of UINavigationController which is starting point of your application. Select navigation controller which is initial root view controller.
Select Navigation Bar from left area below the highlighted Navigation Controller. In Attribute Inspector you can see properties for navigation bar. In this section you can see Bar Tint which shows Default right now.
Change Bar Tint color from properties as your need. Observation here is changes will not be visible in Storyboard, Bar color will remains white in Storyboard color will only visible in Simulator/Device.
See the output in Simulator.
Don't do that. Delete that code. The navigation controller already has a navigation bar; don't add another one.
You're looking in the wrong scene. There's a Navigation Controller scene and a View Controller scene. The navigation bar belongs to the Navigation Controller scene.
I was using the viewController that is flexible for the ipad and iphone. Now in that viewController I inserted a navigation controller for each viewController. (Which surprisingly xcode lets you do that. And at the time I didn't know it was wrong.) So I set the bar tint color at the navigation controller that was not the first one. (It was the second view navigation controller) It therefore had a conflict of which color to take, the color from the first navigation controller, or the current navigation controller.
When using the navigation controller or embedding a view controller in navigation controller, the navigation bar light grey color covers the status bar also (the carrier, time, battery, etc). When dragging a navigation bar onto the view controller, the status bar is still white. You can't change the height of the navigation bar...so how can I make everything look and feel the same? Here's the two images:
As you can see, Chat shows that white space above the nav bar, whereas Social doesn't...any workout for this?
In this case navigation bar looks like non-transparent.
Please check properties of navigation bar and/or initialization of this bar to be sure that it's transparent.