2
pickerview我想在迅速 這是單行選擇多行選擇爲SWIFT 3.0
`進口的UIKit來選擇pickerview多行
類的ViewController:UIViewController中,UIPickerViewDelegate,UIPickerViewDataSource {
@IBOutlet weak var titlelabel: UILabel!
@IBOutlet weak var pickerview: UIPickerView!
var cars = ["benz","audi","lombagini","rangerrover","bently"]
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
pickerview.delegate = self
pickerview.dataSource = self
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return cars.count
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! {
return cars[row]
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
titlelabel.text = cars[row]
}
}`
沒有任何一個有任何想法來選擇picke多行r查看
in objective-c AlPickerview但它不起作用。
那麼你是否得到了解決方案? –