UILabel的使用
主要功能:显示文本用于内容提示
常用属性
NSString *text;
UIColor *textColor;
CGSize *shadowColor;
NSTextAlignment textAlignment;
UIColor *highlightedtextColor;
BOOL highlighted;
NSLineBreakMode lineBreakMode;
BOOL userInteractionEnabled;
NSInteger numberOfLines;
BOOL adjustsFontSizeToFitWidth;
UIImageView 的使用
主要功能:在应用程序中主要用于显示图片的视图
常用属性
UIImage *image;
UIImage *highlightedImage;
BOOL userInteractionEnabled;
BOOL highlighted;
初始化方法
- (id)initWithImage:(UIImage*)image;
- (id)initWithImage:(UIImage*)image highlightedImage:(UIImage*)highlightedImage;
制作动画播放效果
#import "ViewController.h"
@interface ViewController ()
@property(strong,nonatomic) UIImageView *imageView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSArray *imagesArray = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"xiaohai.jpg"],
[UIImage imageNamed:@"xiaogou.jpg"],
[UIImage imageNamed:@"songshu.jpg"],
nil];
_imageView = [[UIImageView alloc] initWithFrame:
CGRectMake(100, 150, 150, 180)];
_imageView.animationImages = imagesArray;
_imageView.contentMode = UIViewContentModeScaleAspectFit;
_imageView.animationDuration = 2;
_imageView.animationRepeatCount = 0;
[self.view addSubview:_imageView];
}
- (IBAction)playAnimation:(id)sender {
if (_imageView.isAnimating) {
[_imageView stopAnimating];
}else{
[_imageView startAnimating];
}
}