欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ios UIimageView帧动画

程序员文章站 2024-01-19 12:57:46
...
//NSArray *_arrayImages4Connecting; 几张图片按顺序切换
- (void)startAnimation4Connection {
    NSArray * _arrayImages4Connecting = [NSArray arrayWithObjects:
                                         [UIImage imageNamed:@"a1.png"],
                                         [UIImage imageNamed:@"a2.png"],
                                         [UIImage imageNamed:@"a3.png"],
                                         [UIImage imageNamed:@"a4.png"],
                                         nil];
    [self.imgView setAnimationImages:_arrayImages4Connecting];
    [self.imgView setAnimationRepeatCount:0];
    [self.imgView setAnimationDuration:3.0f];
    [self.imgView startAnimating];

}
//停止删除
-(void)imgAnimationStop{
    [self.imgView.layer removeAllAnimations];
}