I'm having issues with UITableViewCell .
I have a view manager in my storyboard that is connected to my view controller named MainViewController . It contains a UITableViewCell with three shortcuts. UITableViewCell connected to the MTTableViewCell class.
// MTTableViewCell.h #import <UIKit/UIKit.h> @interface MTTableViewCell : UITableViewCell @property (strong, nonatomic) IBOutlet UILabel *mainLabel; @property (strong, nonatomic) IBOutlet UILabel *statusLabel; @end // MTTableViewCell.m #import "MTTableViewCell.h" @implementation MTTableViewCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code } return self; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end // MainViewController.m -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 1; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; MTTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[MTTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } NSString *namecell = @"namecell"; NSString *statuscell = @"statuscell"; [cell.mainLabel setText:namecell]; [cell.statusLabel setText:statuscell]; return cell; }
The problem is that when MainViewController starts MainViewController nothing is displayed. What am I missing? I don't get any arrangements, just an empty table with 1 empty entry.
ios objective-c uitableview
Arnout
source share