【发布时间】:2023-03-11 13:15:01
【问题描述】:
我想用我的自定义图像替换从服务器加载数据时出现的默认微调器。我有 16 张图片。
知道如何用自定义加载指示器替换它吗?
【问题讨论】:
标签: iphone cocoa-touch uiview
我想用我的自定义图像替换从服务器加载数据时出现的默认微调器。我有 16 张图片。
知道如何用自定义加载指示器替换它吗?
【问题讨论】:
标签: iphone cocoa-touch uiview
这可以使用 UIImageView 来完成(如果您愿意,可以创建自定义 UIView 子类来执行此操作)。基本代码是这样的:
UIImageView* animatedImageView = [[UIImageView alloc] initWithFrame:self.view.frame];
animatedImageView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"spinner-01.png"],
[UIImage imageNamed:@"spinner-02.png"],
[UIImage imageNamed:@"spinner-03.png"],
[UIImage imageNamed:@"spinner-04.png"],
nil];
animatedImageView.animationDuration = 1.0;
animatedImageView.animationRepeatCount = 0;
[animatedImageView startAnimating];
【讨论】: