我想在内部显示一个包含UIPickerView的警报。可能吗 ?有什么想法吗?
非常感谢!
更新
最后,我使用这个出色的库来制作很酷的自定义提醒:
答案 0 :(得分:1)
试试这个:
let alertView = UIAlertController(
title: "Select item from list",
message: "\n\n\n\n\n\n\n\n\n",
preferredStyle: .alert)
let pickerView = UIPickerView(frame:
CGRect(x: 0, y: 50, width: 260, height: 162))
pickerView.dataSource = self
pickerView.delegate = self
// comment this line to use white color
pickerView.backgroundColor = UIColor.lightGray.withAlphaComponent(0.2)
alertView.view.addSubview(pickerView)
let action = UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil)
alertView.addAction(action)
present(alertView, animated: true, completion: { _ in
pickerView.frame.size.width = alertView.view.frame.size.width
})