我有一个UIActivityIndicator
在 iPhone 3G 模拟器/设备中运行良好的设备,但它不适用于 iPhone 4(Retina)的模拟器/设备。我想提一下,它是在黑色背景上。
问问题
1060 次
3 回答
5
我曾经有过类似的问题。通过将指示器样式更改为UIActivityIndicatorViewStyleWhiteLarge
并为背景提供对比色(我选择黑色)来解决此问题。问题实际上是它不可见。
于 2011-01-28T12:17:49.267 回答
2
UIActivityIndicator 不会立即显示。
如果你有这样的代码:
//(pseudo-code)
//Create UIActivityIndicator
//show UIActivityIndicator
//do some other stuff expecting view to show
UIActivityIndicator 不会显示,因为 UIActivityIndicator 只会在程序的下一个运行循环中显示。
您可以通过以下方式解决此问题
{
//create UIActivityIndicator
//show UIActivityIndicator
[self performSelector:@selector(doOtherStuff) withObject:nil afterDelay:0];
}
-(void)doOtherStuff {
//do stuff
}
performSelector 意味着 doOtherStuff 在下一个运行循环中执行,此时 UIActivityIndicator 将显示。
您还必须将其作为子视图添加到您希望它显示的视图中。
于 2011-01-31T08:34:52.943 回答
0
也许您正在显示不是主线程的线程中的微调器?你可以试试这个断言来确定你是否在主线程上:
NSAssert([[NSThread currentThread] isMainThread],
@"This should be run from the main thread.");
如果断言失败,您可以将调用分派到主线程:
dispatch_async(dispatch_get_main_queue(), ^{
// display the spinner
});
无论如何,没有看到代码我们都只是猜测。
于 2011-01-31T08:35:19.217 回答