为什么UIAlertView不显示? [英] Why isn't UIAlertView Showing?
本文介绍了为什么UIAlertView不显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于某些原因,屏幕变暗并冻结,警报未显示...有人可以帮忙吗?
For some reason screen gets dark and freezes, alert is not shown... can someone please help?
提前致谢!
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello!"
message:@"Hello!" delegate:self
cancelButtonTitle:@"Done"
otherButtonTitles:nil];
[alert show];
[alert release];
}
推荐答案
你可能正在打电话<$从后台线程c $ c> show ,在主线程上调用它,如下所示:
You are probably calling show
from a background thread, call it on the main thread like this:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello!"
message:@"Hello!" delegate:self
cancelButtonTitle:@"Done"
otherButtonTitles:nil];
[alert performSelectorOnMainThread:@selector(show)
withObject:nil
waitUntilDone:NO];
[alert release];
这篇关于为什么UIAlertView不显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文