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

前端 未结 8 831
[愿得一人]
[愿得一人] 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

    As Markus says, UIViewController doesn't do anything in its viewDidLoad method, so you don't have to call it. However, it's a good habit to get into, in case you change your inheritance structure and suddenly the class that used to inherit from UIViewController now inherits from something that does do something in the viewDidLoad method.

提交回复
热议问题