为什么 UIAlertView 不显示?

2023-12-04

由于某种原因,屏幕变暗并冻结,未显示警报...有人可以帮忙吗?

提前致谢!

} else {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello!" 
                                                message:@"Hello!" delegate:self 
                                      cancelButtonTitle:@"Done" 
                                      otherButtonTitles:nil];
    [alert show];
    [alert release];
}

您可能正在打电话show从后台线程,在主线程上调用它,如下所示:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello!" 
                                            message:@"Hello!" delegate:self 
                                            cancelButtonTitle:@"Done" 
                                            otherButtonTitles:nil];
[alert performSelectorOnMainThread:@selector(show)
                            withObject:nil
                            waitUntilDone:NO];
[alert release];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

为什么 UIAlertView 不显示? 的相关文章

随机推荐