UIAlert 操作 xcode 8
UIAlert Action xcode 8
我正在尝试制作一个可以将我的游戏用户带到我的网站以查看高分和其他高分的 UIAlertaction。找不到向我展示如何为 URL 编码的教程。因此,可以使用该操作将我的用户带到网站,而不是用于解除警报的警报操作。我使用了一个教程来达到这个目的。我是 xcode8 的新手,正在学习。对不起,如果这是一个愚蠢的问题。我正竭尽全力。感谢您提前提供的所有帮助。任何帮助都会很棒。源代码将是巨大的。我也在用xcode 8。非常感谢
func handleReceivedDataWithNotification(_ notification: Notification) {
let gameset = notification.gameset!
print(gameset)
}
func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController) {
appDelegate.MPCHandler.browser.dismiss(animated: true, completion: nil)
}
您需要做的就是声明您要打开的URL,然后将那个坏男孩喂给右边的API。
func createAlert (title: String, message:String)
{
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: output.text, style: UIAlertActionStyle.default, handler: { (action) in
// Declare a URL what you would like to open
let url = URL(string: "http://test.io")!
// Open website in Safari Mobile
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}))
self.present(alert,animated: true, completion:nil)
}
我正在尝试制作一个可以将我的游戏用户带到我的网站以查看高分和其他高分的 UIAlertaction。找不到向我展示如何为 URL 编码的教程。因此,可以使用该操作将我的用户带到网站,而不是用于解除警报的警报操作。我使用了一个教程来达到这个目的。我是 xcode8 的新手,正在学习。对不起,如果这是一个愚蠢的问题。我正竭尽全力。感谢您提前提供的所有帮助。任何帮助都会很棒。源代码将是巨大的。我也在用xcode 8。非常感谢
func handleReceivedDataWithNotification(_ notification: Notification) {
let gameset = notification.gameset!
print(gameset)
}
func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController) {
appDelegate.MPCHandler.browser.dismiss(animated: true, completion: nil)
}
您需要做的就是声明您要打开的URL,然后将那个坏男孩喂给右边的API。
func createAlert (title: String, message:String)
{
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: output.text, style: UIAlertActionStyle.default, handler: { (action) in
// Declare a URL what you would like to open
let url = URL(string: "http://test.io")!
// Open website in Safari Mobile
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}))
self.present(alert,animated: true, completion:nil)
}