0

I have a one lone TableViewController configured in StoryBoard. I decided, its better to connect it programmatically, rather than with segues, so, I use this code to present my ViewController:

UIStoryboard *aStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
NewProjectViewController *newProject = [aStoryboard instantiateViewControllerWithIdentifier:@"NewProjectViewController"];
newProject.delegate = self;
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:newProject];
[self presentViewController:navController animated:YES completion:nil];  

But the ViewController being shown is simple TableViewController, but I have done some layout in Storyboard. Seems like a bug. I attached screenshots to the post to illustrate question.
How it really is How it has to be

Solved:
The problem was in these two methods, that overrode StoryBoard design:

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
#warning Potentially incomplete method implementation.
    // Return the number of sections.
    return 0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
#warning Incomplete method implementation.
    // Return the number of rows in the section.
    return 0;
}

They were uncommented, but other methods in UITableViewController were commented. Probably, I will have to program all the UI later, because this solution I wanted only for prototyping. Thanx MaKo for the help!

Richard Topchii
  • 7,075
  • 8
  • 48
  • 115

1 Answers1

1

did you connect the outlet of the table on the interface builder to your viewcontroller class?

also, did you connect the data source and delegate of the table on the NIB?

even if you call the nib programatically and style it on the interface builder, you still need to connect the outlets to your class

do you have custom cells? connect them also,

good luch

manuelBetancurt
  • 15,428
  • 33
  • 118
  • 216
  • Yes, everything is connected. I found out, that the reason for the problem is using custom class. Even if I only create standard UITableViewController class without any of my methods, the problem remains. If there is no custom class in nib, everything is OK. – Richard Topchii Jul 27 '14 at 23:39
  • I found the mistake - uncommented methods and posted them to my question. Problem solved, thank you for the help! – Richard Topchii Jul 28 '14 at 00:04