#import <QuartzCore/QuartzCore.h>
addProjectBtn setImage:[Helper getImageWithColor:[UIColor colorWithWhite:0.0 alpha:0.1] withSize:addProjectBtn.frame.s ize] forState:UIControlStateHighlig hted];
+ (UIImage *)getImageWithColor:(UIColor *)color withSize:(CGSize)size{
UIGraphicsBeginImageContext( size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColor(context, CGColorGetComponents(color. CGColor));
CGContextFillRect(context, CGRectMake(0, 0, size.width, size.height));
UIImage *i = UIGraphicsGetImageFromCurrentI mageContext();
UIGraphicsEndImageContext();
return i;
}
No comments:
Post a Comment