initWithNibName VS viewDidLoad

后端 未结 3 593
小鲜肉
小鲜肉 2020-12-31 20:01

I\'ve been trying to understand for hours when I should use the viewDidload: and when I should use initWithNibName: to set up the properties of my viewController.

F

3条回答
  •  不思量自难忘°
    2020-12-31 20:28

    initWithNibName: is called when the NIB is loaded and instantiated.

    viewDidLoad: is called when your view is actually presented onscreen.

    And yes - I believe that in your case, setting colors and such are best done in initWithNibName

提交回复
热议问题