Creating a UIImage from a UIColor to use as a background image for UIButton [duplicate]
I created a category around UIButton to be able to set the background color of the button and set the state. You might find this useful. @implementation UIButton (ButtonMagic) – (void)setBackgroundColor:(UIColor *)backgroundColor forState:(UIControlState)state { [self setBackgroundImage:[UIButton imageFromColor:backgroundColor] forState:state]; } + (UIImage *)imageFromColor:(UIColor *)color { CGRect rect = CGRectMake(0, 0, 1, 1); UIGraphicsBeginImageContext(rect.size); CGContextRef context = … Read more