从我的UIPickerView中的Firebase读取数据

时间:2018-03-12 05:51:19

标签: ios swift firebase firebase-realtime-database uipickerview

我的数据库结构

My database structure

我遇到了从firebase到UIPickerView显示数据列表的问题。

我想将其设置为选项 像firebase中的数据列表应该是我的UIPickerview选项:

import UIKit
import FirebaseDatabase
import Firebase

var vehicalList = [String]()


class CausticSodaEntryVC: UIViewController, UIPickerViewDelegate, 
UIPickerViewDataSource {

@IBOutlet weak var causticVehical: UIPickerView!

func numberOfComponents(in pickerView: UIPickerView) -> Int
{
    return vehicalList.count
}

func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, 
forComponent component: Int) -> String?
{
    return vehicalList[row]
}

func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent 
component: Int) -> Int
{
    return vehicalList.count
}

func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, 
inComponent component: Int)
{
    print(" ")
}

0 个答案:

没有答案