- 父類是UIViewController
UITableViewController常用創(chuàng)建方法
// 指定UITableView的style創(chuàng)建控制器
- (instancetype)initWithStyle:(UITableViewStyle)style NS_DESIGNATED_INITIALIZER;
UITableViewController常用屬性
- 默認(rèn)會創(chuàng)建tableView,并讓其成為自身成員變量,就算把storyboard中的tableView刪掉也會運行,只是沒法通過storyboard直接設(shè)置UITableView和UITableViewCell的屬性
@property (nonatomic, strong, null_resettable) UITableView *tableView; - UITableViewController中的View即tableView,可通過打印地址檢驗
tableViewController.view == tableViewController.tableView
UITableViewController常用方法
- 默認(rèn)遵守了UITableView數(shù)據(jù)源協(xié)議,UITableViewDelegate協(xié)議,是UITableView的代理
- 詳見UITableView
UITableViewController使用過程中,可能會出現(xiàn)的錯誤
- [UITableViewController loadView] instantiated view controller with identifier "UIViewController-BYZ-38-t0r" from storyboard "Main", but didn't get a UITableView.
- 造成這個錯誤的原因
錯誤地將一個UIViewController當(dāng)做UITableViewController來用
-
錯誤做法
Snip20151108_134.png
-
正確做法
Snip20151108_135.png
Snip20151108_137.png


