【发布时间】:2014-01-01 00:36:35
【问题描述】:
在我的应用程序中,我有一组图像,每秒钟都会生成动画。
我使用了以下代码,
animateArrayImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"gallery-img-1.png"],
[UIImage imageNamed:@"gallery-img-2.png"],nil];
animateImageView.animationImages = animateArrayImages;
animateImageView.animationDuration = 1.0f;
animateImageView.animationRepeatCount = 0;
[animateImageView startAnimating];
UIButton *button=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setFrame:CGRectMake(20, 20, 20, 20)];
[self.view addSubview:button];
但是我得到这样的输出
该按钮将显示在图像的背景中。
但我想在图像之前显示它
【问题讨论】:
-
使用 insertSubview:aboveSubview: 或在 addSubview:animateImageView 之后调用 addSubview:button
-
您的触摸仍然可以正常工作。看看你是否在 xib 中有一个图像视图,然后手动添加按钮,也可以通过编程设置按钮的框架类似于图像视图。
标签: ios xcode uiimageview uibutton