您的位置:首页 > 产品设计 > UI/UE

ios6.0中,UIAlertView不能在子线程中执行了

2013-04-17 18:54 225 查看
+(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];



}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: