IOS學(xué)習(xí)筆記(十)之UIImageView圖片視圖的基本概念和使用方法
創(chuàng)新互聯(lián)建站成立以來不斷整合自身及行業(yè)資源、不斷突破觀念以使企業(yè)策略得到完善和成熟,建立了一套“以技術(shù)為基點(diǎn),以客戶需求中心、市場為導(dǎo)向”的快速反應(yīng)體系。對公司的主營項(xiàng)目,如中高端企業(yè)網(wǎng)站企劃 / 設(shè)計(jì)、行業(yè) / 企業(yè)門戶設(shè)計(jì)推廣、行業(yè)門戶平臺運(yùn)營、重慶App定制開發(fā)、成都手機(jī)網(wǎng)站制作、微信網(wǎng)站制作、軟件開發(fā)、雅安服務(wù)器托管等實(shí)行標(biāo)準(zhǔn)化操作,讓客戶可以直觀的預(yù)知到從創(chuàng)新互聯(lián)建站可以獲得的服務(wù)效果。
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.
實(shí)例代碼:
//創(chuàng)建圖片視圖 //創(chuàng)建圖片視圖 UIImageView *p_w_picpathview=[[UIImageView alloc]initWithFrame:CGRectMake(140, 100, 45, 45)]; //設(shè)置高亮 p_w_picpathview.highlighted=YES; //設(shè)置圖片 p_w_picpathview.p_w_picpath=[UIImage p_w_picpathNamed:@"notification_icon"]; //設(shè)置高亮圖片 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); //初始化 加入一張高亮圖片與本身圖片 //默認(rèn)圖片 @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 //設(shè)置為YES 用戶才可以進(jìn)行點(diǎn)擊 //設(shè)置為YES 圖片高亮顯示 @property(nonatomic,getter=isHighlighted) BOOL highlighted NS_AVAILABLE_IOS(3_0); // default is NO