Do not really codil 1.5 months. I stupid strongly :).

In general the question: There are tabs (custom buttons at the top). Below them is the containerView -> pageViewController -> TableViewController (OrdersTableViewController, empty). 5 custom cells for each tab. He made cells on a table controller (OrdersTableViewController) and assigned a unique identifier to each. Inherited 5 classes from the table controller (OrdersTableViewController). Overrides delegate and datasource methods in each class. In pageViewController I create objects of these classes (I register a cell with a specific identifier). Inherited tables are empty: (

What am I doing wrong? and in general, how to? I can not understand how it should work :) From an architectural point of view correctly, maybe something is wrong with the cells ?. Can not see the cell?

enter image description here

Inherited class from OrdersTableViewController (there are 5 custom cells on OrdersTableViewController)

#import "OpenOrders.h" #import "OpenOrderCell.h" #define OPENTASKCELL @"openTasksCell" @implementation OpenOrders - (void)viewDidLoad { [super viewDidLoad]; self.tableView.estimatedRowHeight = 44.0; [self.tableView registerClass:[OpenOrderCell class] forCellReuseIdentifier:OPENTASKCELL]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 10; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { OpenOrderCell *cell = (OpenOrderCell *)[tableView dequeueReusableCellWithIdentifier:OPENTASKCELL forIndexPath:indexPath]; if (cell == nil) { cell = [OpenOrderCell new]; } cell.type.text = @"sjdgshdg"; return cell; } - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath { return UITableViewAutomaticDimension; } @end 
  • cellForRowAtIndexPath or any other datasource method is called at all? and if not, is the delegate and datasource defined - Max Mikheyenko
  • one
    Called, even a cell is created, but (empty) inside all elements are nil. Maybe it is because the custom cells themselves are on the main controller (they are not tied to anything, only to their own custom classes). - iSerg
  • But if you replace the custom one with a regular one and set the cell.textLabel.text, can you see anything? - Max Mikheyenko 1:49 pm
  • Not. So far, I have made 5 separate controllers with a table and each has its own cell. This is most likely a crutch, but for the time being I see no other way out. - iSerg

1 answer 1

In your case, it would be best to use 1 table controller (if it is the same in all tabs, but only the cells change), and custom cells are implemented in separate xib files, register them in the table controller using the registerNib table method and in the - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath method - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath to load the necessary cells depending on the selected tab