我有一个具有用户的firebase数据库,并且在我的应用中,我想要一个PickerView,您可以在其中查看该用户的所有电子邮件/信息。是否可以使用Xcode创建它?
我的代码:
ViewController: UIPickerViewDelegate, UIPickerViewDataSource {
@IBOutlet weak var dropDown: UIPickerView!
@IBOutlet weak var txtUser: UITextField!
var list = ["3","2","1"]
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return list.count
}
func pickerView(pikcerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! {
return list[row]
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
selected = list[row]
txtUser.text = selected
}
}
我刚刚用数字填充了Picker,以查看其是否正常工作。但是,这是我想要插入Firebase数据库的地方。