0
votes

I'm pushing detailViewController (UIViewController) from UITableViewController. detailViewController consists of UITextView and small UITableView. I have set my detailViewController to be UIViewController that implements UITableViewDataSource and UITableViewDelegate protocols.I have delegate and datasource outlets in IB. I have those required table delegate and datasource methods that are called when detailViewController is pushed on top. I get called the methods that set number of sections (1) and number of rows in section (2). The problem is I do not see my tableView on screen when detailViewController is on top.

I have noticed that Xcode warns me about initWithStyle in detailViewController that it may not respond to [super initWithStyle:style]:

- (id)initWithStyle:(UITableViewStyle)style{
  self = [super initWithStyle:style];
  if (self) {
    // Custom initialization
  }
  return self;
} 

I understand that it does not belong to UIViewController but how to get things worked out?

UPDATE: It appears my tableView is shrink-ed. I have set enough height and width for it in IB but it looks like the tableView appears on screen with very narrow one row and it does not resize when the tables fills with rows. IMHO it somehow related to being unable to call initWithStyle. Does anybody achieved similar solution in other ways?

1

1 Answers

0
votes

As you've said, detailViewController is a UIViewController subclass. UIViewController does not implement -initWithStyle:, so the warning is legit.

Can't you subclass detailViewController from UITableViewController?

If you have to use UIViewController, you'd have to have tableView outlet created in detailedViewController and it should be connected to your table in IB. Did you make sure it's done?