首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

关于设置UIView的背景为图片的方法以及有关问题

2013-02-24 
关于设置UIView的背景为图片的方法以及问题UIImageView* imageView [[UIImageView alloc] initWithFrame

关于设置UIView的背景为图片的方法以及问题
UIImageView* imageView = [[UIImageView alloc] initWithFrame:view.bounds]; imageView.image = [[UIImage imageNamed:@"name.png"] stretchableImageWithLeftCapWidth:left topCapHeight:top]; [view addSubview:imageView];

?

这种方式,如果原始图片大小不够(小于view的大小),可以拉伸,在view释放后也没有什么内存保留。

二.通过图片来生成UIColor设置view的backgroundColor

? 1.imageNamed方式

??

热点排行