如何使 UIActivityIndi​​cator 显示在嵌入 UIScrollView 的 UIImageView 之上?

发布于 2024-10-24 08:34:50 字数 311 浏览 1 评论 0原文

我有一个嵌入在滚动视图内部的 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...

Is this right?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

撧情箌佬 2024-10-31 08:34:50

我建议不要将其放在 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.

但可醉心 2024-10-31 08:34:50

我在 Apple 的 PageControl 示例中遇到了类似的问题。 ( http://developer.apple.com/library/ios/samplecode/ PageControl/PageControl.zip )
对我来说,解决方案是删除示例中覆盖的视图方法,然后 z 排序应该正常工作。

- (UIView *)view
{
    return self.scrollView;
}

显然,只有当您的代码不依赖它时,这才有效!

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.

- (UIView *)view
{
    return self.scrollView;
}

Obviously this will only work if your code doesn't depend on it!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文