[button setBackgroundImage:[[UIImage imageNamed:@"buttonline"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 10, 10, 10) resizingMode:UIImageResizi ...
分类:
其他好文 时间:
2016-09-28 19:10:21
阅读次数:
104
//主题设置 [[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"tabbar-light"]]; NSDictionary * dict = @{ NSFontAttributeName : [UIFont systemF ...
分类:
移动开发 时间:
2016-09-09 00:46:35
阅读次数:
178
1 2 3 4 5 6 7 //方法1 UIImage *imag1 = [UIImage imageNamed:@"image.png"]; //方法2 UIImage *image2 = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle ...
分类:
其他好文 时间:
2016-09-01 12:34:19
阅读次数:
151
Apple官方的文档为生成一个UIImage对象提供了两种方法: 1. imageNamed,其参数为图片的名字; 2. imageWithContentsOfFile,其参数也是图片文件的路径。 那么两种有什么区别吗? 肯定是有的。根据Apple的官方文档: imageNamed: 这个方法用一个 ...
分类:
移动开发 时间:
2016-08-31 10:32:36
阅读次数:
225
在 Apple 官方帮助文档提供了两个加载图片的方法 imageNamed , 其参数为图片的名字 imageWithContentsOfFile , 其参数是图片文件的路径 下面主要是说一下他们的区别: imageNamed: 用这个方法加载图片分为两种情况: 系统缓存有这个图片 直接从缓存中取得 ...
分类:
其他好文 时间:
2016-08-27 18:02:38
阅读次数:
102
正确选择图片加载方式能够对内存优化起到很大的作用,常见的图片加载方式有下面三种: 第一种方法:imageNamed: 为什么有两种方法完成同样的事情呢?imageNamed的优点在于可以缓存已经加载的图片。苹果的文档中有如下说法: This method looks in the system ca ...
分类:
移动开发 时间:
2016-08-24 14:25:52
阅读次数:
198
Apple官方文档对于加载image提供了两个方法 + (nullable UIImage *)imageNamed:(NSString *)name; + (nullable UIImage *)imageWithContentsOfFile:(NSString *)path; 那么这两个方法对于 ...
分类:
移动开发 时间:
2016-08-24 13:03:39
阅读次数:
302
动态的交换方法能够给项目中大量已经使用的方法 进行拦截增加操作 实践:利用运行时交换系统的ImageNamed:方法 应用背景 当系统需要适配ios7和ios8时可能会有显示不同图片的需求,但在老项目上开发ios7程序时并未考虑到ios8的适配,当项目上有几百处地方用到ImageNamed:方法时, ...
分类:
其他好文 时间:
2016-08-23 13:20:27
阅读次数:
142
[_iconView sd_setImageWithURL:[NSURL URLWithString:item.image_list] placeholderImage:[UIImage imageNamed:@"defaultUserIcon"] options:SDWebImageCacheMe ...
分类:
其他好文 时间:
2016-08-19 20:51:06
阅读次数:
167
自定义返回按钮是开发工作中很常见的需求,只需要一行代码就可以搞定: self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"back"] style:(UI ...
分类:
其他好文 时间:
2016-08-19 13:09:53
阅读次数:
192