您的位置:首页 > 产品设计 > UI/UE

UIView--UIImageView

2016-01-19 10:23 453 查看
1.contentMode

view.contentMode = UIViewContentModeScaleAspectFill;



2.是否实现触摸



3.简单实现动画 图片的名字为campFire01-campFire17

NSMutableArray * imagearray = [NSMutableArray array];

for (int i = 1; i<=17; i++) {

//拼接图片的名字

NSString *name = [NSString stringWithFormat:@"campFire%@%d",i<10?@"0":@"",i];

//NSString *name = [NSString stringWithFormat:@"campFire%02d",i];

UIImage * image = [UIImage imageNamed:name];

[imagearray addObject:image];

}

UIImageView * view = [[UIImageView alloc]initWithFrame:CGRectMake(40, 40, 320-80, 568-80)];

view.contentMode = UIViewContentModeScaleAspectFit;

view.animationImages = imagearray;//直接接受数组

view.animationDuration = 2;//时间

view.animationRepeatCount = 0;//重复多少次 0表示无数次

[view startAnimating];

4.拉伸

- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight

这个函数是UIImage的一个实例函数,它的功能是创建一个内容可拉伸,而边角不拉伸的图片,需要两个参数,第一个是左边不拉伸区域的宽度,第二个参数是上面不拉伸的高度。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: