- (void)viewDidLoad {
[super viewDidLoad];
//UIImage png jpg
NSString *path = [[NSBundle mainBundle] resourcePath]; // 工程目录路径
NSString *imagePath = [NSString stringWithFormat:@"%@/1.png", path];
UIImage *image = [[UIImage alloc] initWithContentsOfFile: imagePath];
//图片需要一个载体 才能显示在屏幕上
UIImageView *imageView = [[UIImageView alloc] initWithImage: image];
imageView.frame = CGRectMake(10, 100, 300, 300);
imageView.backgroundColor = [UIColor yellowColor];
[self.view addSubview: imageView];
//内容模式
/*
UIViewContentModeScaleToFill - 拉伸图片 充满整个载体
UIViewContentModeScaleAspectFill 拉伸不改变比例, 充满最小的一边(大的那一边可能会超出)
UIViewContentModeScaleAspectFit 拉伸不改变比例, 充满长度大的一边,另一边自适应
*/
imageView.contentMode = UIViewContentModeScaleAspectFill;
//uiImageView动画 - 播放序列图
}