Application dynamically choosing which icons/images to use

I am creating an application that will be able to switch its UI theme to different colors including icons. I plan to have different sets of icons that will be stored on different folders(green folder, yellow folder, etc). The name of the icons will be the same across all the folders the only thing that will change is its color.

Here is the code that i am currently using when setting the images for buttons and icons

[menuBtn setBackgroundImage:[UIImage imageNamed:@"menuBtn.png"] forState:UIControlStateNormal]

For example if the user selected yellow as the app theme. internally there will be some kind of switch that will choose a path for the image ex. the code above will evaluate to something like "yellow/menuBtn.png" when user selects yellow or "green/menuBtn.png" when the user selects green. Is this possible?


Sure, you can do [UIImage imageNamed:[NSString stringWithFormat:@"%@/menuBtn.png", colourVar]] and just set colourVar prior to setting the image.

Need Your Help

UITableView in UIScrollView not responding to first tap after scroll

ios objective-c uitableview uiscrollview

I'm experiencing a strange issue where my UITableView is not properly responding to taps after the scroll view it is contained within is scrolled at all. I say properly because it is highlighting t...

How to convert some values in a dict into a list in a clean style in Python?

python list dictionary iteration

My code is like follows, just wondering if there's better way to implement it in Python.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.