【发布时间】:2012-05-21 05:14:30
【问题描述】:
我正在申请
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]; });}
【问题讨论】: