UITabBar remove the black background - ios

As the title states, I haven't been successful in removing the black background in the UITabBar.
I know it is possible to add a subview on top of it. But I want it to be transparent so if I add a transparent subview on top of it, it will just have the underlying black color.
Setting the tintColor made me able to change the color of the UITabBar, but when I change it to clearColor it will just be black again.
Anybody know how to remove the underlying image or color so it will be transparent?

When they added the tintColor property in iOS 5, they also added a number of other appearance-customization functionality to UITabBar. See, backgroundImage and selectionIndicatorImage, and the finishedSelectedImage and finishedUnselectedImage properties of UITabBarItem.

Related

Why is my viewController background color permanently white?

If I change the background color and run the app the color works fine, but as soon as I add subViews like a tableView or a containerView the still visible parts of the background becomes white.
I have tried:
- To set the color programatically. Still white.
- To add another UIView on the superView, add the subViews to that and changed the color on the UIView instead. Still white.
- While on the same approach as above, changed the superView color and set the UIView color to clear. Still white.
- Changed the alpha value to 0, but this makes the subViews invisible as well.
This is the hierarchy:
Have never run into this problem before and I don't understand it...
Check every outlet in storyborad if it has a background color of white . Or self.view.backgroundcolor to clearcolor may work , There must be a view under the view which color is white. Or sometimes there needs time to load the storyboard and this causes some undefined behaviour.You can try a dispatch_time_after in viewdidLoad and then start your code from there.

remove tab bar blurred effect

Is there any away to remove tab bar blurred effect
I set background image and it looks like the first picture.
If I make it transparent, you can see the table through it like the second picture.
I want to make it like the third picture
You can make it transparent using
the barTintColor property.
nameOfTabBar.barTintColor = .clear
This property is incharge of the tint color to apply to the tab bar background.
You can find more information on https://developer.apple.com/documentation/uikit/uitabbar

Set the background of UILabel to transparent black

I have a UILabel that whose background I want to set to black with alpha component so that this label can have a transparent black background.
In the storyboard when I set the background to the colour I want with an alpha component even the text of the label that is in white colour becomes lighter with the alpha component.
To overcome this problem I embedded the label in a UIView and even then the same problem persists.
How can I overcome this problem. Any help will be appreciated.
You can Do only With label make IBObject an write following line.
label.backgroundColor = UIColor.black.withAlphaComponent(0.4)
Instead of changing the alpha value, change the opacity of the label background color in storyboard.
For better understanding, I have taken an imageView and placed a label at the bottom of imageView and changed the background color of the label and textColor to white. At this stage you can't see the image behind the label.
Now, go to attributes inspector and select the label background color. There you can see the opacity and change it's value. Here I have made it 50%, you can change it to whatever you want between 0 to 100 until you get your desired transparency.
create the UIview with black background color and add the UIlabel inside the view and set the alpha to 0.5 of view . finally you get the black transparent, for e.g
if you need the label text in bold change the view hierarchy
place the UILabel fist then add the UIView.
Place the UILabelabove the UIView, not inside it.
Assume that we are talking about v1 the view that contains your label , if v1 is over another view that has bright colors then when your v1's alpha get lower your label white text color will become harder to see , the text color has nothing to do with the background alpha component , so you need to reconsider using the white color or the alpha component background or the view that is behind v1 make it darker that's all we can say

Set Statusbar color to same as Nav Bar

I want the Status Bar of my app to have the exact same color as my Navigation Bar. The way I found to change the color of the Status Bar was just by creating a view in the size of the Status Bar and change the background color.
However even though I use the color picker from the Nav bar to set the color of the view I get 2 totally different colors as seen in the picture below.
I've tried mixing with the color picker, changing opacity etc, however I'm never able to hit the correct color. Any ideas on how I can get the exact same color for the status bar?
The color of the UIStatusBar is automatically set to match the color of the UINavigationBar when you set the value of self.navigationController.navigationBar.barTintColor. Is there a reason you need to set them separately?
You can do the following:
Create an UIImage containing only the color you want with a size of 64x1. You could render that image in code.
Set the image as a background image for the navigationBar. Something like:
navigationController.navigationBar.setBackgroundImage(image, for: .default)

UITabBar not updating appearance after Load

I am having a problem with UITabBar, seems like the call to
[[UITabBar appearance] setSelectedImageTintColor:barColor];
does nothing once the tabbar is showing, if i put the line in the ViewDidLoad (ViewWillAppear) it does work.
Any hint?
in the Apple docs for UITabBar it says
"The tint color to apply to the gradient image used when creating the selected image."
Note the creating, meaning that it reads this property when initalising/creating the tab bar, but it can't be set after. If you wanted to dynamically you'd have to get a little bit fiddly and overlay a semi transparent UIView over the selected image to change the colour, but it's not really ideal... There is some examples of that type of thing here
Changing Tint / Background color of UITabBar

Resources