Swift uialertcontroller和用户协议
我正在尝试显示一个UIAlertController,它将显示我的服务条款。我不能简单地将服务条款粘贴到邮件正文中,实现这一点的最佳方法是什么。我也只是在应用程序首次发布时调用它一次Swift uialertcontroller和用户协议,swift,xcode,uialertcontroller,Swift,Xcode,Uialertcontroller,我正在尝试显示一个UIAlertController,它将显示我的服务条款。我不能简单地将服务条款粘贴到邮件正文中,实现这一点的最佳方法是什么。我也只是在应用程序首次发布时调用它一次 func agree(){ let alert = UIAlertController(title: "Terms of Service", message:"", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "Ag
func agree(){
let alert = UIAlertController(title: "Terms of Service", message:"", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Agree", style: .default, handler: { (action: UIAlertAction) in
print("OK")
}))
self.present(alert, animated: true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
if UserDefaults.standard.bool(forKey: "Walkthrough") {
print("already shown")
// Terms have been accepted, proceed as normal
} else {
agree()
UserDefaults.standard.set(true, forKey: "Walkthrough")
}
}
我会以文本视图的形式向视图控制器展示服务条款,并在底部显示同意/不同意按钮。在声明函数
agree
后,您是否需要简单地将服务条款粘贴到消息正文中?同意@Leo。我想你是想用UIAlertController
把20磅的东西放在一个5磅重的袋子里。有一次VC可能是最好的/最简单的方法。有道理,我是选择Leo作为答案,还是应该如何结束这个问题?