私はどこでアプリケーションを作っています
1)通話を受け入れるか拒否するためのアラートビューを表示します。
2)ただし、発信者自身からの通話がキャンセルされた場合は、発信者によって通話がキャンセルされたことを示すアラートが表示されます。
私の問題は、それを受け入れる前に通話がキャンセルされた場合、アラートビューがスタックされ、アラートビュー(2)のクローザーにアラートビュー(1)が表示されますが、私の要件はビューを直接表示することですアラートビューのいずれかに近い。
アラートビューを生成するメソッドを作成しました。アラートビューにdiffタグを付けます
-(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]; });
}