Latest 1.4.0
Homepage https://github.com/mxcl/UIImageWithColor
License Public Domain
Platforms ios
Frameworks UIKit
Authors

Version
License
Platform

Create (optionally resizable & rounded) plain-colored UIImages..

CocoaPods

CocoaPods is the recommended way to use UIImage+ImageWithColor in your project.

  • Simply add this line to your Podfile: pod 'UIImage+ImageWithColor'
  • Run pod install.

Manual installation

  • Add UIImage+ImageWithColor header and implementation to your project (2 files total).

How To Use It

#import "UIImage+ImageWithColor.h"

//…

UIColor *color = [UIColor colorWithWhite:0 alpha:0.33];
UIImage *img = [UIImage imageWithColor:color];
[self.button setBackgroundImage:img forControlState:UIControlStateNormal];

// or if you need an image with dimensions greater than 1x1 pixels
UIColor *color = [UIColor redColor];
UIImage *img = [UIImage imageWithColor:color size:CGSizeMake(20, 20)];
[self.button setBackgroundImage:img forControlState:UIControlStateNormal];

// or if you need a resizable/stretchable image with rounded corners
UIColor *color = [UIColor purpleColor];
UIImage *img = [UIImage resizableImageWithColor:color cornerRadius:10];
[self.button setBackgroundImage:img forControlState:UIControlStateNormal];

Author

Created and maintained by Max Howell (@Max Howell).

License

This is free and unencumbered software released into the public domain.

Latest podspec

{
    "name": "UIImage+ImageWithColor",
    "version": "1.4.0",
    "summary": "Create (optionally resizable & rounded) plain-colored UIImages.",
    "license": "Public Domain",
    "authors": {
        "Max Howell": "[email protected]"
    },
    "platforms": {
        "ios": null
    },
    "source": {
        "git": "https://github.com/mxcl/UIImageWithColor.git",
        "tag": "1.4.0"
    },
    "source_files": "*.{h,m}",
    "requires_arc": false,
    "frameworks": "UIKit",
    "homepage": "https://github.com/mxcl/UIImageWithColor",
    "module_name": "UIImageWithColor"
}

Pin It on Pinterest

Share This