0

我在 ViewController 中显示动画。动画图像是一组图像。当我开始动画时,图像将覆盖我放在 ViewController 上的一个标签。在动画过程中如何将标签保留在图像顶部?下面是我的动画代码;

 CGRect frame = CGRectMake(0, 62, 325, 290);
NSMutableArray *animationImageArray = [NSMutableArray arrayWithCapacity:4];
for (int i=0;i<4;i++)
{
    NSString *imageName = [NSString stringWithFormat:@"radar0%d.png",i+1];
    UIImage *animationImage = [UIImage imageNamed:imageName];
    [animationImageArray addObject:animationImage];
}
UIImageView *animationImageView = [[UIImageView alloc]initWithFrame:frame];
animationImageView.animationImages = animationImageArray;
animationImageView.animationDuration = 3;
animationImageView.animationRepeatCount = 1;
[animationImageView startAnimating];
[self.view addSubview:animationImageView];
4

1 回答 1

0

将 UILabel 添加到 UIApplication 的 keyWindow,而不是控制器的视图中:

UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
[keyWindow addSubview:myLabel];

或者,您可以在添加动画后将标签带到视图的前面UIImageView

[self.view bringSubviewToFront:myLabel];
于 2013-07-06T09:13:47.063 回答