What is the difference between UIViewController and UITableViewController

后端 未结 3 856
醉梦人生
醉梦人生 2021-02-05 21:37

Sometimes I want to subclass UIViewController for some app wide customizations. Eg. something that all view controllers should perform during viewDidLoad or viewWillAppear or so

3条回答
  •  轮回少年
    2021-02-05 21:52

    So despite the obvious stuff, are there any miracles that UITableViewController takes care of?

    Not that I am aware of. As far as I know UITableViewController is mostly a convenience class that can be replaced with your own subclass that adds a few lines of code.

    Apple's class documentation pretty much says all that UITableViewController does (and I'm not repeating that here because it may well change in the future). Sometimes, additional information can be gleaned from a class' header file, but in the case of UITableViewController.h the source code comments just repeat what is already in the class docs.

    In the end you must decide yourself what you want to replicate in your own subclass. Maybe your project does not need .nib handling? Or none of your table views is editable? So just don't code that...

提交回复
热议问题