UIImageView 轮播一组图片

2018-12-07  本文已影响7人  会飞的大西瓜v
self.activityImageView = [[UIImageView alloc] initWithFrame:CGRectMake(PHONE_WIDTH / 2 - 75, PHONE_HEIGHT / 2 - 75, 150, 150)];
        self.activityImageView.backgroundColor = [UIColor clearColor];
        [self.view addSubview:self.activityImageView];
        
        NSMutableArray *images = [[NSMutableArray alloc] initWithCapacity:3];
        
        for (int i = 1; i <= 3; i ++) {
            NSString *imageName = [NSString stringWithFormat:@"loading%d",i];
            UIImage *image = [UIImage imageNamed:imageName];
            [images addObject:image];
        }
        
        self.activityImageView.animationImages = images;
        self.activityImageView.animationDuration = 0.8;
        [self.activityImageView startAnimating];
        
        [NSTimer scheduledTimerWithTimeInterval:15 target:self selector:@selector(destructionActivityImageView) userInfo:nil repeats:NO];
上一篇下一篇

猜你喜欢

热点阅读