iOS: What is the difference between -init and -viewLoad of a ViewController?

前端 未结 3 1628
遥遥无期
遥遥无期 2020-12-05 10:35

I don\'t know exactly what\'s the right place to set things like the tintColor of the NavigationBar or the title of my ViewController. It works in the -init method and the -

3条回答
  •  猫巷女王i
    2020-12-05 11:20

    the init method is used to initialize the viewController while viewDidLoad method is used to load your nib(i.e. your view). so when you want to do something with your viewController then use init method and when you want to do something with your view then use viewDidLoad.

提交回复
热议问题