Do I always have to call [super viewDidLoad] in the -viewDidLoad method?

前端 未结 8 863
[愿得一人]
[愿得一人] 2020-11-27 16:18

In Apple\'s scrollView example they don\'t call that. I always thought that\'s a must. Why should I call that anyways?

8条回答
  •  情书的邮戳
    2020-11-27 16:40

    You don't have to call the [super viewDidLoad]

    As far as I know, the viewDidLoad in the superclass (UIViewController) is only an empty function that gets called when the ViewController gets initialized with a nib-file.

    So if you need to do any initializing, you should override this function and put your code there.

提交回复
热议问题