How can I tell my UITableViewController
to use my custom UITableView
subclass for it's tableView
instead of a regular UITableView
?
Set the UITableViewController.tableView property to an instance of your custom UITableView subclass.
loadView
with something like self.tableView = [[MyTableViewSubclass alloc] init]
or something of the sort. –
Divisor delegate
and dataSource
too or your table won't load anything. –
Plowman In interface builder associate the tableview class with your custom tableview in the identity inspector view
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.
© 2022 - 2024 — McMap. All rights reserved.
initWithStyle:
after I setself = [super initWithStyle:style]
. How do I know what changes-[UITableViewController initWithStyle:]
made to itstableView
? I might be undoing those. See #8513293 – Nautilus