如何在用户向下滚动时启用按钮UIAlertController?

时间:2016-08-14 09:01:15

标签: swift uialertcontroller

有没有办法设置UIAlertController以允许用户只有在向下滚动文本时才按下确定按钮?

如果我使用UIAlertController中的消息字段来显示(多行)文本并添加UITextField,我已经成为了那里的一部分。它需要一种方法来使textField像一个复选框。

let termsOfService = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse sem arcu, vestibulum non aliquam sit amet, pellentesque eu urna. Sed posuere eu metus eu dapibus. Praesent vitae vulputate felis. Donec erat elit, ullamcorper nec lectus eu, sagittis faucibus nibh. Etiam ligula elit, dignissim fringilla ornare vel, eleifend sit amet enim. Vestibulum ac cursus ipsum. Curabitur augue nisl, ultrices vitae massa quis, auctor faucibus dui. Integer ut est velit. Cras felis purus, dictum id iaculis id, ultricies nec dui. Duis sollicitudin nisi vel massa egestas trirtique. Fusce tempus gravida tellus a rhoncus. Integer id sapien non purus efficitur aliquam vitae varius lectus. In malesuada felis egestas neque pretium condime"
let alert = UIAlertController(title: "Agreement", message: termsOfService, preferredStyle: UIAlertControllerStyle.Alert)
alert.addTextFieldWithConfigurationHandler { (textField) -> Void in
    textField.text = "I agree"
}
let okayAction = UIAlertAction(title: "Ok", style: .Default) { (action) in
    print(action)
}
alert.addAction(okayAction)
let cancelAction = UIAlertAction(title:"Cancel",
            style: .Cancel) { (action) -> Void in
                print(action)
        }
alert.addAction(cancelAction)
self.presentViewController(alert, animated: true, completion: nil)

0 个答案:

没有答案