gpt4 book ai didi

ios - iOS 中的图像迭代

转载 作者:行者123 更新时间:2023-11-28 21:45:23 24 4
gpt4 key购买 nike

是否有更好的方法来迭代以下图像?

NSArray *imageNames = @[@"MyImage-0.png", @"MyImage-1.png", @"MyImage-2.png",@"MyImage-3.png",@"MyImage-4.png", @"MyImage-5.png", @"MyImage-6.png", @"MyImage-7.png"];

NSMutableArray *images = [[NSMutableArray alloc] init];
for (int i = 0; i < imageNames.count; i++) {
[images addObject:[UIImage imageNamed:[imageNames objectAtIndex:i]]];
}

mImageView.animationImages = images;
mImageView.animationDuration = 1.5;

[self.view mImageView];
[mImageView startAnimating];

最佳答案

NSInteger imagesCount = 7;    
NSMutableArray *images = [[NSMutableArray alloc] init];
for (int i = 0; i <= imagesCount; i++) {
[images addObject:[UIImage imageNamed:[NSString stringWithFormat:@"MyImage-%d", i]]];
}

mImageView.animationImages = images;
mImageView.animationDuration = 1.5;

[self.view mImageView];
[mImageView startAnimating];

关于ios - iOS 中的图像迭代,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30431021/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com