skip to Main Content

I have a requirement to make application that has color theme base on user selection
User selects an color at begining (in 8 available colors), that color will be applied for the whole app (background color, buttons, icons ….)

If I create images for each color, the app will have lots of images and can be heavy in size, and that approach not seem to be good one.

I tried to import images with 1 color and then change images color according to user-selected color, but got problem with some controls like slider, and also the image that is changed does not look good as photoshop one

Would u plz help me with good approach for this?

2

Answers


  1. Make all the images one color (black probably), then let the user pick a color and save it to user defaults. Link all items that need to get the theme to the color from the user defaults. Then use the tintColor property of the UIImageView to themefy your app.

    Method to tint any UIImageView:

    - (void)tintImageView:(UIImageView *)imageView withTint:(UIColor *)tintColor
    {
        imageView.image = [imageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
    
        [imageView setTintColor:tintColor];
    }
    

    Example use to tint Button:

    [self tintImageView:self.button.imageView withTint:[UIColor blueColor]];
    

    Example use to tint UIImageView:

    [self tintImageView:self.imageView withTint:[UIColor blueColor]];
    
    Login or Signup to reply.
  2. If you’re using iOS7 you can take advantage of the tintColor property.
    For images you need to be sure they are created using template option.
    Please checkout this clear tutorial that will guide you to apply themes to different kind of controls in your app: Theming iOS Applications

    You could probably be interested in trying Pixate Freestyle too, which basically allow you to apply styles like css does to your iOS app, that a pretty cool tool and I’ve found it very easy to use too.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search