This is either an XCode bug, or me missing a crucial rule here.
Update: - What\'s the chance of this being a weird bug in XCode/Storyboard?
Heyo, I just had this problem today and figured out a few possible causes. To link a UITableView as a subview of a ViewController in Story board check that you have done these steps.
In your "ViewController.h", add <UITableViewDataSource>
to your list
of protocols
@interface ViewController : UIViewController
<UITableViewDataSource>
you might want to add <UITableViewDelegate>
as well but I didn't.
In your "ViewController.m" set up your Table view data source functions
#pragma mark - Table view data source}- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [yourCells count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NewCell *cell = (NewCell *)[tableView dequeueReusableCellWithIdentifier:@"NewCell"]; if (cell == nil) { NSLog(@"Cell is NIL"); cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } return cell;
In Storyboard, connect the UITableView's "Data Source" and "Delegate" references to the ViewController.
If these are done, I believe it should work.
Hope this helps =)
It maybe late to answer this but i bet this will fix all your problems
I always use custom cells in the storyboard like this:
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
return cell;
Make sure the number of rows/sections is at least one. And another thing to check is that you set the UITableViewController to your custom class name in the storyboard.
To solve this problem add the following just above your dequeueReusableCellWithIdentifier statement:
static NSString *CellIdentifier = @"NewCell";
making sure the identifier matches the prototype cell in Storyboard