iOS UIImage一个小用法

1  self.imageView.image = [UIImage imageNamed:@"16"];
2     self.imageView.animationDuration = 0.5;
3     self.imageView.animationImages = @[[UIImage imageNamed:@"1"],[UIImage imageNamed:@"2"],[UIImage imageNamed:@"3"]];
4 [self.imageView startAnimating];

一组图片闪动播放,很简单,但是老忘记怎么写。。。

/* 以下是对图片拉伸操作,使图片自适应大小作为button的背景*/

1                 UIButton *imageBtn = [UIButton buttonWithType:UIButtonTypeCustom];
2                 imageBtn.frame = CGRectMake(0 + j* 105, 0, 100, 100);
3                 UIImage *buttonImage = [UIImage imageNamed:[content.picture objectAtIndex:j]];
4                 UIImage *stretchableButtonImage = [buttonImage stretchableImageWithLeftCapWidth:12 topCapHeight:0];
5                 [imageBtn setBackgroundImage:stretchableButtonImage forState:UIControlStateNormal];
6                 imageBtn.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:[content.picture objectAtIndex:j]]];
7                 [imageBtn addTarget:self action:@selector(imageBtnAction:) forControlEvents:UIControlEventTouchUpInside];
8                 [self.pictureView addSubview:imageBtn];
原文地址:https://www.cnblogs.com/song-kl/p/4577308.html