我想创建自定义活动指示器它有两个图像一个图像将静态(在后台),另一个图像将在前面,它必须移动左,右,上,下(只是为了给动画感觉)。我试图使用下面的代码(其错误的一个)。任何人都可以帮助我,如何做动画iOS:自定义活动指示器
UIImage *statusImage = [UIImage imageNamed:@"image1.png"];
UIImageView *activityImageView = [[UIImageView alloc]
initWithImage:statusImage];
//Add more images which will be used for the animation
activityImageView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"image1.png"],
[UIImage imageNamed:@"image2.png"], nil];
//Set the duration of the animation (play with it
//until it looks nice for you)
activityImageView.animationDuration = 7;
activityImageView.frame = CGRectMake(
self.view.frame.size.width/2
-statusImage.size.width/3,
self.view.frame.size.height/2
-statusImage.size.height/3,
statusImage.size.width/3,
statusImage.size.height/3);
//Start the animation
[activityImageView startAnimating];
PLZ不与图像发起的ImageView '[[UIImageView的页头] initWithImage:statusImage]' 尝试与框架或仅初始化启动。 –
@RatulSharker为什么不呢?你想说什么? –