UIView--UIImageView

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的一个实例函数,它的功能是创建一个内容可拉伸,而边角不拉伸的图片,需要两个参数,第一个是左边不拉伸区域的宽度,第二个参数是上面不拉伸的高度。

 

原文地址:https://www.cnblogs.com/huoran1120/p/5141366.html