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
  •  | 
  •  

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?

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top