I have a UITableViewController
that has a table view with static cells. I have added some costume cells with UIImageView
and UILabel
in them. Everything looks fine in the xcode storyboard:
since the cells are static I do NOT implement the datasource methods here's my code for the table view controler:
#import "MainTableViewController.h"
@interface MainTableViewController ()
@end
@implementation MainTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
but when I run the code in the simulator the cells' content won't appeare:
here's the Scene hierarchy:
UITableView with static cells not showing up for me either - I tried to remove and re-add the segue. Everything was properly set up. The trick....
The trick is to remove the following row, cell, and section methods from your UITableViewController subclass. They are automatically added by Xcode, but if you are using static cells, you don’t want them in your class.
– (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
– (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
Once you have removed these methods, your cells will show up correctly.
I think you have problem with constraints! If you have wrong constraint for elements inside cell, elements will not shown!
Please make sure you have selected "Static Cells" in content option of Table View
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With