我试图把UIPickerView
放在UIAlertView
但是我似乎无法正确调整它的大小。这里就是我得到:调整UIAlertView内的UIPickerView
这里是我的代码:
let alertView = UIAlertController(title: "Select item from list", message: "", preferredStyle: UIAlertControllerStyle.alert)
let pickerView = UIPickerView(frame: CGRect(x: 0, y: 0, width: 250, height: 60))
pickerView.dataSource = self
pickerView.delegate = self
alertView.view.addSubview(pickerView)
let action = UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil)
alertView.addAction(action)
parent.present(alertView, animated: true, completion: nil)
添加更多的高度选择器,60是不够的,尝试300或smthing像 –
你有没有检查这一个http://stackoverflow.com/a/40191156/6433023 –