let allertController = UIAlertController.init(title: "\n\n\n\n\n\n\n\n\n\n\n\n", message: nil, preferredStyle: .ActionSheet)
//此处\n是为了给date picker留出位置
let datePicker = UIDatePicker()
datePicker.mj_x = 20
//这里偏移量最好精确计算,我这里简单设置下,让picker尽量显示在中间
datePicker.datePickerMode = UIDatePickerMode.Time
//设置
swift中用UIAlertController包装一个UIdatePicker
最新推荐文章于 2024-03-13 09:35:32 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)