在打开phone.app之前显示UIAlertView

我有一个button和button上的标签在地图上的看法。 在标签上我有一个来自plist的电话号码。 plist中的电话号码variables叫做“storePhone”,我用这种方式实现它:

text4.text = myAnn.storePhone; 

我做了这个方法按下button,并打开phone.app拨号。 一切都很好,但我想要一个UIViewAlert对用户说:“你要拨这个号码,你确定吗? 在phone.app打开之前。

我怎样才能做到这一点?

这是我的button方法:

 -(IBAction)callToStore { NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", text4.text]]; [[UIApplication sharedApplication] openURL:url]; } 

谢谢。

我做的。
这是你如何做到的:

 - (IBAction)moreInfoViewAlert:(id)sender { UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"חיוג לסניף" message:@"הנך עומד/ת לבצע חיוג, האם את/ה בטוח?" delegate:self cancelButtonTitle:@"ביטול" otherButtonTitles:@"חיוג", nil]; [message show]; } - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { NSString *title = [alertView buttonTitleAtIndex:buttonIndex]; if([title isEqualToString:@"חיוג"]) { NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", text4.text]]; [[UIApplication sharedApplication] openURL:url]; } } 

将IBAction方法附加到您的button,你很好去。