我想显示一个弹出窗口,询问用户与推送通知相关的偏好,为此,我想向用户显示一个选项列表。用户可以选择多个选项。
我想我必须在UIAlertView中显示一个表视图,但现在已经不推荐使用了。那么,我如何在Swift中的APN系统权限对话框之前显示弹出窗口(带有一些小消息+多选列表)呢。
任何帮助都将不胜感激。
您可以使用以下代码:
let alert = UIAlertController(title: title, message:message, preferredStyle: .Alert)
let action = UIAlertAction(title: "OK", style: .Default) { _ in
acceptNotification = true //code to execute when the user taps that OK
}
alert.addAction(action)
//you can add more actions
self.presentViewController(alert, animated: true){ // this part if provided, will be invoked after the dismissed controller's viewDidDisappear: callback is invoked.
}