How to make default tab bar as full transparent - ios

Transperent imageI am working on a tab bar application.I applied the color to the tab bar like this
[[UITabBar appearance] setBarTintColor:[UIColor colorWithRed:137.0/255.0f green:27.0/255.0f blue:2.0/255.0f alpha:1.0f]];
My requirement is to display the tab bar transparent like below image
After applying the below code.tab bar is not displaying transparent. but it is displaying with black color background
self.tabBarController.tabBar.backgroundColor = [UIColor clearColor];
self.tabBarController.tabBar.translucent = YES;
Give suggestions for making the default tab bar as transperent
black color background image

You can create an empty image and pass it as a backgroundImage:
[[UITabBar appearance] setBackgroundImage:[UIImage new]];
You can use a similar approach for shadows and tint, but pay attention that a tint color is something very particular that has to deal with you whole UI.

Related

UITab Bar - Selection Indicator Image - Change Position

I am using a UITabBarController. In my AppDelgate I am setting the selectionIndicatorImage to a simple white line. This is showing up in the middle of the tab bar item. I want it to show in the top of my tab bar item, highlighting that it is selected. I tried making an image with a white line on top and transparent on the bottom but then it just showed up way above my tab bar. Is there a certain size I need to make this image to achieve what I am after?
Image I'm Using: https://www.dropbox.com/s/zva77z9yt6rcfsg/SelectedTab.png?dl=0
UIImage *selectedImage = [[UIImage imageNamed:#"SelectedTab"] stretchableImageWithLeftCapWidth:0 topCapHeight:0];
[[UITabBar appearance] setSelectionIndicatorImage:selectedImage]
You have to create translucent selectedTab (see zip file) with top white line and height should be 48 Pixel
check this link https://www.dropbox.com/s/j38mqj8sd0qgv8f/selectedTab.zip?dl=0
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:#"selectedTab.png"]];
[[UITabBar appearance] setBarTintColor:[UIColor blackColor]];
Results:

UISearchBar changes background when selecting text field

I want background of UISearchBar to be black, but when selecting the text field, it slides up and changes the background to gray:
Default:
--
When selected:
if you want to set black colour in background of UISearchBar then try it ..
UISearchBar *searchbar=[[UISearchBar alloc]init];
searchbar.barTintColor = [UIColor blackColor];
UISearchBar has a translucent property, make sure it's set to false.
Without more information, this is my best guess as to why this is happening: your tint color is black, but it's translucent, when it's not selected it shows as black because there's no view underneath, but when it's selected, a white view moves behind it, causing the black translucent to look gray.
Try this,
[[UISearchBar appearance] setBackgroundColor:[UIColor blackColor]];
[[UISearchBar appearance] setBarTintColor:[UIColor blackColor]];

Slide Menu IOS Using aryaxt/iOS-Slide-Menu

I am trying to change Navigation bar background color in viewDidLoad using the same example in the link below but that's not working.
[[UINavigationBar appearance] setBackgroundColor:[UIColor greenColor]];
please help.
https://github.com/aryaxt/iOS-Slide-Menu
To change the NAv bar color, You have to use bar tint color:
self.navigationController.navigationBar.barTintColor=[UIColor greenColor];

Navigation Bar color and a View's color

I'm getting a weird, i have a navigation bar and a view that is right under it.
I set both of them to [UIColor BlueColor], but at run time the outcome is that the nav bar has a slit darker color then the view.
Any knows what causes this?
Thanks
Your problem is that the navigation bar is translucent, and therefore the bar color is put on top of the view's color, making it appear darker. Try making the bar not translucent.
navigationBar.translucent = NO;
You can try this one:--
navigationController.navigationBar.barTintColor = [UIColor greenColor];
or
[[UINavigationBar appearance] setBarTintColor:[UIColor greenColor]];

Using global Tint color as UINavigationBars backgroundColor

i need to set the UINavigationBars background color to the same value as my apps global tint color.
problem here is that now all buttons in my navigation bar are the same color as its background. i now could change all UIBarButtons text color to white but this would be totally unusable. using the UIAppearance API doesn't seem to be a better way. after setting the text color of UIBarButton items to white, f.e the back arrows of the back button in my UINavigationBar are still painted with the global tint color.
also if i change the global tint color to white i loose all the flexibility that the global tint color gives us (also my text indicator would now be white and would not be seen on a white background)
what i want:
what i get using blue as global tint color
what i get when using blue as global tint color and setting uibarbutton items text color to white (see the back button - it should be white as well)
what is the recommended way to fix this problem?
I recommend that you do this:
UINavigationBar *navigationBar = [UINavigationBar appearance];
navigationBar.tintColor = [UIColor whiteColor];
Place this code in the didFinishLaunchingWithOptions: method in the AppDelegate.
For clarification as you are obviously not very experienced with this:
barTintColor is the property that would change the bar colour. tintColor changes the colour of interactive objects (such as the UIBarButtonItems)
if ([[UINavigationBar class] respondsToSelector:#selector(appearance)]) {
[[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
}
Try to set UINavigationBar setTintColor in specified controller (in viewDidLoad for example).

Resources