ios6.0中,UIAlertView不能在子线程中执行了
来源:互联网 发布:软件模块 编辑:程序博客网 时间:2024/05/06 18:59
+(DisplayErrorMsg *)sharedDisplayErrorMsg
{
static DisplayErrorMsg *instance = nil;
@synchronized(instance)
{
if (instance == nil) {
instance = [[DisplayErrorMsg alloc] init];
}
}
return instance;
}
-(void)showAlertView:(NSString *)title Message:(NSString *)msg
{
NSArray *array = [NSArray arrayWithObjects:title,msg, nil];
[self performSelectorOnMainThread:@selector(doAlert:) withObject:array waitUntilDone:NO];
}
-(void)doAlert:(NSArray *)array
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[array objectAtIndex:0] message:[array objectAtIndex:1] delegate:nil cancelButtonTitle:@"关闭" otherButtonTitles:nil];
AppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.window addSubview:alert];
[alert show];
[alert release];
}
{
static DisplayErrorMsg *instance = nil;
@synchronized(instance)
{
if (instance == nil) {
instance = [[DisplayErrorMsg alloc] init];
}
}
return instance;
}
-(void)showAlertView:(NSString *)title Message:(NSString *)msg
{
NSArray *array = [NSArray arrayWithObjects:title,msg, nil];
[self performSelectorOnMainThread:@selector(doAlert:) withObject:array waitUntilDone:NO];
}
-(void)doAlert:(NSArray *)array
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[array objectAtIndex:0] message:[array objectAtIndex:1] delegate:nil cancelButtonTitle:@"关闭" otherButtonTitles:nil];
AppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.window addSubview:alert];
[alert show];
[alert release];
}
- ios6.0中,UIAlertView不能在子线程中执行了
- 为什么不能在子线程中更新UI
- 为什么不能在BroadcastReceiver中开启子线程
- 为什么不能在子线程中修改UI
- 子线程中执行定时器
- 在子线程中 执行相关操作 请求网络
- 关于子线程中不能调用updateallviews
- 在子线程中Toast
- 在子线程中Toast
- OkHttp 执行流程与为什么Callback在子线程中执行
- 在Application的onCreate中创建线程,线程不能被执行
- EventBus抛异常了,不能在子线程更新UI。
- 在子线程中操作主线程
- android中的UI视图更新不能放在子线程中操作
- android 不能在子线程中更新ui的讨论和分析
- 网络访问不能在主线程中,要新建一个子线程,重写run()方法。
- 关于so库中的方法不能在子线程中调用的问题
- android 不能在子线程中更新ui的讨论和分析
- 写给支持和反对<完全用Linux工作>的人们(王垠)
- as3中访问控制权限与java访问控制权限对比
- 定时器/计数器
- 研究生了,你会查文献吗??这里能会有所帮助
- 1003 A+B 九度Online Judge
- ios6.0中,UIAlertView不能在子线程中执行了
- Dedecms后台登录空白 De解决方法
- 1004 Median 九度Online Judge
- 网络编程
- 数位dp CF 55 D. Beautiful numbers
- 在线修改数据文件的大小-users
- 注册表常用操作
- 获取URL的返回值
- 研究:Android有设计缺陷 可窃取用户数据