Ios 录制标签时,呼叫和短信选项同时出现
我正在尝试制作一个联系人电话簿应用程序,通过录制电话号码,if将启动以打开呼叫应用程序或短信应用程序 到目前为止,我已经找到了以下选择:Ios 录制标签时,呼叫和短信选项同时出现,ios,swift,sms,call,Ios,Swift,Sms,Call,我正在尝试制作一个联系人电话簿应用程序,通过录制电话号码,if将启动以打开呼叫应用程序或短信应用程序 到目前为止,我已经找到了以下选择: UIApplication.shared.open(tlfURL, options: [:], completionHandler: nil) UIApplication.shared.open(smsURL, options: [:], completionHandler: nil) 这些必须单独命名。 有没有办法通过在标签上点击一次来触发呼叫和短信启动选
UIApplication.shared.open(tlfURL, options: [:], completionHandler: nil)
UIApplication.shared.open(smsURL, options: [:], completionHandler: nil)
这些必须单独命名。
有没有办法通过在标签上点击一次来触发呼叫和短信启动选项
如果没有任何建议,如何实施?UIActivityViewController
谢谢我会用
UIAlertController
与
它将帮助您向用户提供多个选项,让用户选择他们想要做的事情。看起来是这样的:
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) // makes a new UIAlertController with no title or message
// makes a new UIAlertAction to call on tap
let callAction = UIAlertAction(title: "Call", style: .default) { _ in
UIApplication.shared.open(tlfURL, options: [:], completionHandler: nil)
}
// makes a new UIAlertAction to sms on tap
let smsAction = UIAlertAction(title: "SMS", style: .default) { _ in
UIApplication.shared.open(smsURL, options: [:], completionHandler: nil)
}
// makes a new cancel action so the user can decide not to take any actions
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
// add the actions to the UIAlertController
alertController.addAction(callAction)
alertController.addAction(smsAction)
alertController.addAction(cancelAction)
// present the UIAlertController to the user so they can interact with it
present(alertController, animated: true, completion: nil)
我会使用
UIAlertController
与
它将帮助您向用户提供多个选项,让用户选择他们想要做的事情。看起来是这样的:
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) // makes a new UIAlertController with no title or message
// makes a new UIAlertAction to call on tap
let callAction = UIAlertAction(title: "Call", style: .default) { _ in
UIApplication.shared.open(tlfURL, options: [:], completionHandler: nil)
}
// makes a new UIAlertAction to sms on tap
let smsAction = UIAlertAction(title: "SMS", style: .default) { _ in
UIApplication.shared.open(smsURL, options: [:], completionHandler: nil)
}
// makes a new cancel action so the user can decide not to take any actions
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
// add the actions to the UIAlertController
alertController.addAction(callAction)
alertController.addAction(smsAction)
alertController.addAction(cancelAction)
// present the UIAlertController to the user so they can interact with it
present(alertController, animated: true, completion: nil)
UIActivityViewController要好得多,因为这样用户可以看到一组标准的选项,并可以选择他们想要做的事情。UIActivityViewController要好得多,因为这样用户可以看到一组标准的选项,并可以选择他们想要做的事情。