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