如何使 UIActivityIndicator 显示在嵌入 UIScrollView 的 UIImageView 之上?
我有一个嵌入在滚动视图内部的 imageView,以便允许我捏合和缩放 imageView 中的图像。然而,我想添加一个在加载图像数组时旋转的活动指示器。
我将指标放在 IB 中需要的位置,然后通过 IBOutlet 将其连接起来。当视图加载时它会旋转,并在正确的时间停止,唯一的问题是它位于图像和滚动视图的后面,而不是我需要它的顶部。
我可以做什么来改变这个并将指示器发送到前面?我尝试在 IB 中发送到后面以及发送到前面,但都不起作用...
I have an imageView that is embedded inside of a scrollView so as to allow me to pinch and zoom the image in the imageView. I would like however to add an activity indicator to be spinning while the array of images is being loaded.
I put the indicator where I need it in IB, then hooked it up via an IBOutlet. It is spinning when the view loads, and stops at the correct time, the only problem is that it is behind the image and scroll views, not on top where I need it to be.
What can I do to change this and send the indicator to the front? I tried sending to back in IB as well as sending to front, neither have worked...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议不要将其放在 UIScrollView 中。只需将它放在 UIScrollView 的顶部,但将根 UIView 作为其父级。您可以在文档查看器中拖动它(按 Cmd-0)并拖动它,以便活动指示器与根 UIView 的其他子级列为同一级别。列表顶部的内容位于“后面”,因此请确保活动指示器列在 UIScrollView 下方(但不在 UIScrollView 内部)。
I would recommend not putting it inside the UIScrollView. Just sit it on top of the UIScrollView visually, but make the root UIView as its parent. You can drag it around in the Document Viewer (hit Cmd-0) and drag it so that the activity indicator is listed as the same level as the other children of the root UIView. The things at the top of the list are in the "back" so make sure the activity indicator is listed below (but not inside) the UIScrollView.
我在 Apple 的 PageControl 示例中遇到了类似的问题。 ( http://developer.apple.com/library/ios/samplecode/ PageControl/PageControl.zip )
对我来说,解决方案是删除示例中覆盖的视图方法,然后 z 排序应该正常工作。
显然,只有当您的代码不依赖它时,这才有效!
I experienced a similar problem with Apple's PageControl example. ( http://developer.apple.com/library/ios/samplecode/PageControl/PageControl.zip )
For me the solution was to remove the overridden view method in the example, then the z-ordering should work as normal.
Obviously this will only work if your code doesn't depend on it!