Uilabel Use main features: Display text for content hints Common properties
NSString*text;//uilabel the text content displayed;Uicolor*textcolor;//color of text displaycgsize*shadowcolor;//Shadow of text displayNstextalignment textalignment;//Text alignment (left-aligned, centered, right -aligned)Uicolor*highlightedtextcolor;//Text highlighting Yes display colorBOOLhighlighted;//Set text highlightingNslinebreakmode Linebreakmode;//If you need to set this property for multiple lines of displayBOOLuserinteractionenabled;//uilabel whether to allow interactionNsintegerNumberOfLines;//Uilabel text displays the number of lines, if 0 means no limitBOOLAdjustsfontsizetofitwidth;//Adjust font size according to Uilabel size
Main features of Uiimageview: View common properties used primarily for displaying pictures in an application
UIImage *image;//UIImageView显示的图片内容,默认是nilUIImage *highlightedImage;//当UIImageView被选中的时候显示的图片内容 默认是nilBOOL userInteractionEnabled;//UIImageView及其上得元素是否交互(非常重要)BOOL highlighted;//UIImageView是否是高亮状态
Initialize method
- (id)initWithImage:(UIImage*)image;
- (id)initWithImage:(UIImage*)image highlightedImage:(UIImage*)highlightedImage;Animate playback effects
#import "ViewController.h" @interface viewcontroller ()@property(Strong,nonatomic)Uiimageview*imageview;@end @implementation viewcontroller - (void) Viewdidload {[SuperViewdidload];additional setup after loading the view, typically from a nib. //Define an array to hold the picture object Nsarray*imagesarray = [[NsarrayAlloc] Initwithobjects: [UIImageimagenamed:@"Xiaohai.jpg"], [UIImageimagenamed:@"Xiaogou.jpg"], [UIImageimagenamed:@"Songshu.jpg"],Nil];//Initialize a picture view_imageview = [[UiimageviewAlloc] Initwithframe:cgrectmake ( -, Max, Max, the)];//Assign a picture array to an animated picture of the picture view_imageview. Animationimages= Imagesarray;//Set the picture to be scaled by the original scale. Maintain aspect ratio_imageview. Contentmode= Uiviewcontentmodescaleaspectfit;//Toggle action Duration, seconds_imageview. Animationduration=2;//Animation repeat times, 0 o'clock free cycle_imageview. Animationrepeatcount=0; [ Self. ViewAddsubview:_imageview];} - (ibaction) Playanimation: (ID) Sender {if(_imageview. isanimating) {[_imageview stopanimating];//Pause playback}Else{[_imageview startanimating];//Start playback}}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Use of Uilabel and Uiimageview