我正在申请
1)我显示一个警报视图以接受或拒绝呼叫....
2) 但是,如果呼叫被呼叫者本身取消,则会显示一个警报,说明呼叫被呼叫者取消。
我的问题是,如果在我接受之前取消呼叫,警报视图会堆叠,并且在警报视图(2)附近我仍然可以看到警报视图(1),因为我的要求是直接在更接近任何警报视图。
我已经创建了一种生成警报视图的方法我给警报视图提供了差异标签
-(void)generateMessage:(const char*)msg Title:(const char*)title withAcceptButton:(bool)doAddAcceptButton Tag:(int)tag{
dispatch_async(dispatch_get_main_queue(), ^{
// We are now back on the main thread UIAlertView *alertView = [[UIAlertView alloc] >init]; //add button if(doAddAcceptButton==true) { [alertView addButtonWithTitle:@"OK"]; [alertView addButtonWithTitle:@"Cancel"]; alertView.cancelButtonIndex=1; } else { [alertView addButtonWithTitle:@"OK"]; alertView.cancelButtonIndex=0; } //add tag [alertView setTag:tag]; //add title if(title==NULL) { [alertView setTitle:@"MESSAGE"]; } else { NSMutableString *head = [[NSMutableString >alloc] initWithCString:title >encoding:NSUTF8StringEncoding]; [alertView setTitle:head]; [head release]; } if(msg==NULL) { [alertView setMessage:@"ERROR"]; } else { NSMutableString *body = [[NSMutableString >alloc] initWithCString:msg >encoding:NSUTF8StringEncoding]; [alertView setMessage:body]; [body release]; } [alertView setDelegate:self]; [alertView show]; [alertView release]; });
}