方法分析

来源:互联网 发布:怎么做网络水军 编辑:程序博客网 时间:2024/04/28 23:31

- (UIImage *) buttonImageFromColor:(UIColor *)color {

    CGRect rect = CGRectMake(0, 0, 320, 44);

    UIGraphicsBeginImageContext(rect.size);

    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextSetFillColorWithColor(context, [color CGColor]);

    CGContextFillRect(context, rect);

    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return img;

}//颜色转换图片


0 0
原创粉丝点击