IOS学习笔记(十)之UIImageView图片视图的基本概念和使用方法
IOS学习笔记(十)之UIImageView图片视图的基本概念和使用方法
创新互联建站成立以来不断整合自身及行业资源、不断突破观念以使企业策略得到完善和成熟,建立了一套“以技术为基点,以客户需求中心、市场为导向”的快速反应体系。对公司的主营项目,如中高端企业网站企划 / 设计、行业 / 企业门户设计推广、行业门户平台运营、重庆App定制开发、成都手机网站制作、微信网站制作、软件开发、雅安服务器托管等实行标准化操作,让客户可以直观的预知到从创新互联建站可以获得的服务效果。
Author:hmjiangqq
Email:jiangqqlmj@163.com
UIImageView:
作用:专门用于显示图片
首先看下官方的解说:
An p_w_picpath view object provides a view-based container for displaying either a single p_w_picpath or for animating a series of p_w_picpaths. For animating the p_w_picpaths, the UIImageView
class provides controls to set the duration and frequency of the animation. You can also start and stop the animation freely.
When a UIImageView
object displays one of its p_w_picpaths, the actual behavior is based on the properties of the p_w_picpath and the view. If either of the p_w_picpath’s leftCapWidth
ortopCapHeight
properties are non-zero, then the p_w_picpath is stretched according to the values in those properties. Otherwise, the p_w_picpath is scaled, sized to fit, or positioned in the p_w_picpath view according to the contentMode
property of the view. It is recommended (but not required) that you use p_w_picpaths that are all the same size. If the p_w_picpaths are different sizes, each will be adjusted to fit separately based on that mode.
All p_w_picpaths associated with a UIImageView
object should use the same scale
. If your application uses p_w_picpaths with different scales, they may render incorrectly.
实例代码:
//创建图片视图 //创建图片视图 UIImageView *p_w_picpathview=[[UIImageView alloc]initWithFrame:CGRectMake(140, 100, 45, 45)]; //设置高亮 p_w_picpathview.highlighted=YES; //设置图片 p_w_picpathview.p_w_picpath=[UIImage p_w_picpathNamed:@"notification_icon"]; //设置高亮图片 p_w_picpathview.highlightedImage=[UIImage p_w_picpathNamed:@"notification_icon"]; [self.window addSubview:p_w_picpathview];
- (id)initWithImage:(UIImage *)p_w_picpath; //初始化一张图片 - (id)initWithImage:(UIImage *)p_w_picpath highlightedImage:(UIImage *)highlightedImage NS_AVAILABLE_IOS(3_0); //初始化 加入一张高亮图片与本身图片 //默认图片 @property(nonatomic,retain) UIImage *p_w_picpath; // default is nil //高亮图片 @property(nonatomic,retain) UIImage *highlightedImage NS_AVAILABLE_IOS(3_0); // default is nil @property(nonatomic,getter=isUserInteractionEnabled) BOOL userInteractionEnabled; // default is NO //设置为YES 用户才可以进行点击 //设置为YES 图片高亮显示 @property(nonatomic,getter=isHighlighted) BOOL highlighted NS_AVAILABLE_IOS(3_0); // default is NO
新闻名称:IOS学习笔记(十)之UIImageView图片视图的基本概念和使用方法
网站网址:http://cdiso.cn/article/jeeogs.html