打开phone.app之前显示UIAlertView
我在地图上有一个视图,其中有一个按钮和按钮上的标签。 标签上有来自 plist 的电话号码。 plist 中电话号码的变量称为“storePhone”,我以这种方式实现它:
text4.text = myAnn.storePhone;
我创建了这个方法来按下按钮并打开phone.app 来拨打号码。 一切都很好,但我想要一个 UIViewAlert 对用户说这样的话:“你要拨打这个号码,你确定吗?”在phone.app打开之前。
我怎样才能做到这一点?
这是我的按钮方法:
-(IBAction)callToStore
{
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", text4.text]];
[[UIApplication sharedApplication] openURL:url];
}
谢谢。
I have a view on map with a button and a label on the button.
On the label i have phone number that comes from a plist.
The variable of the phone number in the plist called "storePhone" and i implemented it in this way:
text4.text = myAnn.storePhone;
I made this method for pressing the button and opening the phone.app for dialing the number.
Everything works great but i want a UIViewAlert to say to the user something like:"your going to dial this number, are you sure?" before the phone.app is open.
How can i do that?
This is my button methode:
-(IBAction)callToStore
{
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", text4.text]];
[[UIApplication sharedApplication] openURL:url];
}
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我做到了。
您可以这样做:
将 IBAction 方法附加到您的按钮,然后就可以开始了。
I did it.
This is how you do it:
Attach the IBAction method to your button and you're good to go.