swift3 - UIAlertView 中的时间选择器

标签 swift3 uialertview

我需要一个要求输入时间的弹出窗口,我认为警报 View 是可行的方法,但我不知道从哪里开始将时间选择器嵌入到警报 View 中。

除非有更好的方法吗?

最佳答案

对于其他人,我将评论中的问题改编为时间选择器,如下所示:

let vc = UIViewController()
vc.preferredContentSize = CGSize(width: 250,height: 300)
let pickerView = UIDatePicker(frame: CGRect(x: 0, y: 0, width: 250, height: 300))
vc.view.addSubview(pickerView)
let editRadiusAlert = UIAlertController(title: "Choose ETA", message: "", preferredStyle: UIAlertControllerStyle.alert)
editRadiusAlert.setValue(vc, forKey: "contentViewController")
editRadiusAlert.addAction(UIAlertAction(title: "Set ETA", style: .default, handler: nil))
editRadiusAlert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
self.present(editRadiusAlert, animated: true)

关于swift3 - UIAlertView 中的时间选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42949529/

相关文章:

ios - 将可选字符串解包为 Int 并使其成为非可选的

ios - 如何禁用 UIButton 并发送 UIAlertView 消息

javascript - React Native AlertIOS api 中可以有多个文本字段吗?

ios - 使用 UIAlertView 以编程方式退出 iOS 应用程序

swift3 - 无法覆盖在 BEMSimpleLineGraph 中标记为不可用的 method_name

ios - 从适用于 iOS 10 的 xcode 7.3.1 将应用程序上传到 iTunes

ios - 从 UIAlertView 文本字段获取文本的问题

iphone - UIAlertView 不起作用

swift - 字符串插值和字符串连接之间的区别

ios - Swift - 在锁屏/控制中心隐藏 URL