UIColor from string

Discussion in 'iOS Programming' started by sujithkrishnan, Jul 28, 2008.

  1. macrumors 6502

    Joined:
    May 9, 2008
    Location:
    Bangalore
    #1
    Hi all..

    Is there any method which will give me a UIColor, provided i gave a valid colorName as String ??

    I am having aPlist which will tells the app to set which backColor, textColor etc.... etc...

    My app will read that and set the color...

    Instead of a longer " Switch and case" i am searching for a method which will return the Color.
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    If it was an instance method then you could get a selector and use the normal method to perform the selector.

    I'm not clear if you can do this with class methods or not. You could try something like:

    Code:
    [UIColor performSelector:NSSelectorFromString(@"blackColor")];
    
    and see if it works (I'm not on a Mac to try it myself...)
     

Share This Page