UIImage-Color 1.1.1

UIImage-Color 1.1.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Mar 2016

Maintained by Sam McEwan.



  • By
  • Sam McEwan

A couple of useful category methods relating to UIImage and colour.

Colorization

Category for UIImage to colorize it. Perfect for changing the color of a glyph with a neutral color.

To use simply invoke with -

    _imageView.image = [_disclosureImage cl_changeColor:[UIColor greenColor]];

Supports both retina and regular display scales.

Tiny Image

Creates a tiny image of a certain color, allowing it to be used when color states are not an option such as UIButton.

    [btn setBackgroundImage:[UIImage cl_imageWithColor:[UIColor grey]] forState:UIControlStateDisabled];  
    [btn setBackgroundImage:[UIImage cl_imageWithColor:[UIColor red]] forState:UIControlStateNormal];  
    [btn setBackgroundImage:[UIImage cl_imageWithColor:[UIColor black]] forState:UIControlStateHighlighted];  

Note: Some parts of these snippets have been floating around in one form or another. Keen to attribute them to their original owner.