UIAlertView中的时间选择器

问题描述 投票:2回答:2

我需要一个要求时间输入的弹出窗口,我认为一个alertview将是要走的路,但我不知道从哪里开始将时间选择器嵌入到alertview中。

除非有更好的方法这样做?

swift3 uialertview
2个回答
5
投票

对于其他任何人,我在评论中将问题调整为如此的时间选择器:

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)

0
投票

您可以使用此组件来获取日期和时间选择器的警报感觉

https://github.com/palKaran/UIAlertDateTimePicker

© www.soinside.com 2019 - 2024. All rights reserved.