iOS中UIImage和UIColor之间的转换
来源:互联网 发布:linux vi中查找字符串 编辑:程序博客网 时间:2024/06/11 04:28
//UIColor 转UIImage
- (UIImage*)imageWithColor: (UIColor*)color
{
CGRect rect=CGRectMake(0.0f,0.0f, 100.0f,50.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context =UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [colorCGColor]);
CGContextFillRect(context, rect);
UIImage *Image =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return Image;
}
//UIImage转UIColor
UIButton *Button = [[UIButtonalloc] initWithFrame:CGRectMake(20,200, 100, 50)];
UIImage *image = [UIImageimageNamed:@"radio_bn.png"];
[cancelButton setBackgroundColor:[UIColorcolorWithPatternImage:image]];
转载请注明出处:http://blog.csdn.net/sevenquan
- iOS中UIImage和UIColor之间的转换
- UIImage和UIColor的转换
- uiimage和uicolor的转换
- UIColor和UIImage转换
- UIColor和UIImage转换
- UIColor和UIImage转换
- UIColor和UIImage转换
- UIImage和UIColor之间的转变
- IOS中uiimage和uicolor相互转化
- iOS中uiimage和uicolor相互转化
- UIColor和UIImage的相互转换
- ios 中Nsstirng,Nsdata,char,byte,UIImage 之间的转换
- ios 中Nsstirng,Nsdata,char,byte,UIImage 之间的转换
- ios 中Nsstirng,Nsdata,char,byte,UIImage 之间的转换
- ios 中Nsstirng,Nsdata,char,byte,UIImage 之间的转换
- ios 中Nsstirng,Nsdata,char,byte,UIImage 之间的转换
- IOS中UIImage与UIColor相互转化
- iOS - uiimage和uicolor相互转化
- 学习Makefile笔记
- Castor实现XML与Java的互转
- android SAX解析XML学习笔记
- Web Services 指南之:Web Services 相关标准
- c# 资源文件做背景音乐
- iOS中UIImage和UIColor之间的转换
- struts2 url 中文乱码问题解决方法
- 获取status bar的高度
- lcd驱动程序之显示图片
- Java NIO学习总结二(Buffer缓冲区)
- STM32之keil MDK下建立第一个工程
- android实例开发之公交查询笔记(一)
- 51单片机的WR、RD问题
- 有用吧? 写了个比sqrtf()快一倍的sqrt()函数