When I load from a .nib do I still need to create a view to assign to View?

StackOverflow https://stackoverflow.com/questions/18909521

  •  29-06-2022
  •  | 
  •  

Frage

Assuming that I call

  protected MyViewController(string nibName, NSBundle bundle)  :
     base(nibName, bundle) { }

do I still need to

public override void LoadView
{
  View = new MyView(...);
  base.LoadView()
}

It seems that calling the nib should just make the View. Am I misunderstanding how nibs work?

War es hilfreich?

Lösung

No, your understanding is correct.

You use LoadView to instantiate the view if you are not using a .xib (i.e. you are creating the programatically).

If you are using a .xib, don't override LoadView

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top