Solved

UITabBar color

Posted on 2014-09-05
3
188 Views
Last Modified: 2015-01-22
Hi guys,

I am trying to set the selected and unselected color for my UITabBar icons and text,

My code doesn't seem to be working what is the best solution, I have the following in the appdelegate

Note: the only thing thats not working is the unselected state.

UIImage *tabBarBackground = [UIImage imageNamed:@"TabBar.png"];
    
    [[UITabBar appearance] setBackgroundImage:tabBarBackground];
    
    [[UITabBar appearance] setTintColor:[UIColor blackColor]];
    [[UITabBar appearance] setSelectedImageTintColor:[UIColor blackColor]];
    
    
    [[UIView appearanceWhenContainedIn:[UITabBar class], nil] setTintColor:[UIColor redColor]];
    [[UITabBar appearance] setSelectedImageTintColor:[UIColor greenColor]];
    

Open in new window

0
Comment
Question by:john_yourspace
  • 2
3 Comments
 
LVL 19

Expert Comment

by:Shahan Ayyub
ID: 40313879
Did you try TabBar delegate functions ? e.g., didSelectItem ? Change the image for all button and then selected image of the button that tapped ?
0
 

Author Comment

by:john_yourspace
ID: 40313886
Do you have some sample code to try
0
 
LVL 19

Accepted Solution

by:
Shahan Ayyub earned 500 total points
ID: 40314412
Look at this thread. You have to use this delegate functions and assigned `delegate` property to call it at runtime. In this delegate you can iterate on `tabBar.items` and assigned an image to them. First assigned deselect image to all of them then the item passed in delegate function assigned it a selected image. Currently i don't have mac so can not give you an example code, but will try to give you soon.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Open Office 365 shared calendar on iPhone 2 288
Process to backup imac and reinstall OS 12 77
iPad Won't Connect 16 89
I don't seem able to remove photos from my iPhone 5 3 29
In this article we have discussed about the OS X EI Capitan and how to fix Wi-Fi issue in OS X El Capitan. We have explained how to delete system level preferences and create a new Wi-Fi location to resolve Wi-Fi issue.
Set up iPhone and iPad email signatures to always send in high-quality HTML with this step-by step guide.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question