?
Solved

UITabBar color

Posted on 2014-09-05
3
Medium Priority
?
222 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

iCloud Drive was introduced after iOS 8 was launched last year. This drive is Apple’s online storage device that lets users sync their files and access them from all their Apple devices.   There is a lot of data that is not automatically backed up…
Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

771 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