Using a UITableView subclass with a UITableViewController

后端 未结 3 993
独厮守ぢ
独厮守ぢ 2021-01-04 03:07

How can I tell my UITableViewController to use my custom UITableView subclass for it\'s tableView instead of a regular UITableVi

相关标签:
3条回答
  • 2021-01-04 03:46

    A UITableViewController is just a UIViewController with a UITableView instance and the viewController set as the delegate and dataSource for the table. The viewController implements stubs for those delegate methods.

    You can do it yourself by having a UIViewController implement the UITableViewDataSource and UITableViewDelegate protocols. Then in the UIViewController's loadView (or viewDidLoad) method set the tableView instance's dataSource and delegate to self.

    You can use your own table subclass there.

    0 讨论(0)
  • 2021-01-04 03:50

    In interface builder associate the tableview class with your custom tableview in the identity inspector view

    0 讨论(0)
  • 2021-01-04 04:11

    Set the UITableViewController.tableView property to an instance of your custom UITableView subclass.

    0 讨论(0)
提交回复
热议问题