I have a view controller MainVC which contains a view where I want to switch between various tables. I have an "abstract" class called InfoVC which extends UITableViewController and contains several methods that must be overridden or else they throw an exception. Finally, I have several classes which extend InfoVC and implement the "abstract" methods in InfoVC, along with methods that override tableView s numberOfRowsInSection and cellForRowAtIndexPath.
This is how I load a table in MainVC. In this case, TemperatureInfoVC extends InfoVC, self.subVC is of type InfoVC, and switchView is a view in MainVC:
TemperatureInfoVC *sVC = [[TemperatureInfoVC alloc] initWithStyle:UITableViewStylePlain];
self.subVC = sVC;
[sVC release];
[switchView insertSubview:self.subVC.view atIndex:0];
我的问题是,表格总是空洞的。 从定点到点,我可以看到,“温度信息”栏号是“OfRowsIn”栏,但“温度信息”或“IndexPath”号都不叫。 然而,如果我把上述法典的第一行改为:
InfoVC *sVC = [[InfoVC alloc] initWithStyle:UITableViewStylePlain];
然后,InfoVC的编号OfRowsInsection and cellForRowAtIndexPath被适当称为。 是否有任何人知道为什么没有叫TyratureInfoVC的L.ForRowAtIndexPath?