UIActivity 指示器在 iPhone 4(视网膜)上不起作用
我有一个 UIActivityIndicator,它在 iPhone 3G 模拟器/设备上运行良好,但在 iPhone 4(Retina) 模拟器/设备上不起作用。我想提一下,它是黑色背景的。
I have an UIActivityIndicator
which is working as well as good in iPhone 3G simulator/device, but it is not working on Simulator/Device for iPhone 4(Retina). I would like to mention that it is on a black background.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我以前也遇到过类似的问题。通过将指示器样式更改为 UIActivityIndicatorViewStyleWhiteLarge 并为背景提供对比色(我选择黑色)来解决此问题。问题实际上是它不可见。
I had a similar problem sometime back. It was solved by changing the indicator style to
UIActivityIndicatorViewStyleWhiteLarge
and giving a contrasting color(I chose black) to the background. The problem actually is that it's not visible.UIActivityIndicator 不会立即显示。
如果您有这样的代码:
UIActivityIndicator 将不会显示,因为 UIActivityIndicator 只会在程序的下一个运行循环中显示。
您可以通过以下方法解决此问题:
performSelector 意味着 doOtherStuff 将在下一个运行循环中执行,此时 UIActivityIndicator 将显示。
您还必须将其作为子视图添加到您希望其显示的视图中。
The UIActivityIndicator will not show up immediately.
If you have code such as this:
the UIActivityIndicator will not show up, as the UIActivityIndicator will only show on the next run loop of the program.
You can get around this by
The performSelector means that the doOtherStuff is performed on the next run loop, when the UIActivityIndicator will show.
You also have to add it as a subview to the view in which you want it to show.
也许您正在从非主线程的线程显示微调器?您可以尝试这个断言来确定您是否在主线程上:
如果断言失败,您可以将调用分派到主线程:
无论如何,在没有看到代码的情况下我们都只是猜测。
Maybe you’re displaying the spinner from a thread that’s not the main thread? You can try this assert to find out whether you’re on the main thread:
If the assert fails, you can dispatch the call to the main thread:
Anyway, without seeing the code we are all just guessing.