2013-03-17 2 views

답변

7

UIImage 카테고리로 만드십시오.

등의 사용 방법 UIImage(Color)

+ (UIImage *)imageWithColor:(UIColor *)color andSize:(CGSize)size 
{ 
    UIGraphicsBeginImageContextWithOptions(size, YES, 0); 

    [color set]; 
    UIBezierPath * path = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, size.width, size.height)]; 
    [path fill]; 

    UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 
    UIGraphicsEndImageContext(); 

    return image; 
} 

등 :

#import "UIImage + Color" 

UIImage *image = [UIImage imageWithColor:[UIColor redColor] andSize:yourSize]; 
관련 문제