title: iOS - how to set picker data when I use uiview to uiviewcontroller
body: <p>hello guys I'm trying to make some util that I need like Pokedex kk</p>
  
  <p>but I have some problem. I make the picker in separate view and I call that view in tabview and use it.</p>
  
  <p>but I don't know how to set the data. If I make picker in uiviewcontroller I can set data in <strong>didload?</strong> method but in uiview there are no <strong>didload</strong> method that I can set.</p>
  
  <p>this is my code </p>
  
  <blockquote>
    <p>SelectPoke.swift</p>
  </blockquote>
  
  <pre><code>class SelectPoke: UIView , UIPickerViewDelegate , UIPickerViewDataSource{
  @IBOutlet var textField: UITextField!
  
  var data =  ["1","2","3"]
  var picker = UIPickerView()
  
  public func numberOfComponents(in pickerView: UIPickerView) -&gt; Int {
      return 1
  }
  
  public func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -&gt; Int{
      return data.count
  }
  
  func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
      textField.text = data[row]
  }
  
  func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -&gt; String? {
      return data[row]
  }
  
  func h(){
      picker.delegate = self
      picker.dataSource = self
  }
  
  override func awakeFromNib() {
      h()
  }
  
  class func instanceFromNib() -&gt; UIView {
      return UINib(nibName: "SelectPoke", bundle: nil).instantiate(withOwner: nil, options: nil)[0] as! UIView
  }
  </code></pre>
  
  <p>}</p>
  
  <blockquote>
    <p>Tab1ViewController.swift</p>
  </blockquote>
  
  <pre><code>class Tab1ViewController: UIViewController {
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
  
      let sideView = SelectPoke.instanceFromNib()
      sideView.frame = self.view.frame
  
      self.view.addSubview(sideView)
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  </code></pre>
  
  <p>}</p>
  
  <p>plz help me. my Pokemon is waiting..</p>