で困っていUITableViewCell
ます。
ストーリーボードにビュー コントローラーがあり、ビュー コントローラーに接続されていますMainViewController
。UITableViewCell
3 つのラベルが含まれています。はUITableViewCell
クラスに接続されていMTTableViewCell
ます。
// 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;
}
問題は、実行時に何も表示されないことですMainViewController
。私は何が欠けていますか?エラーは発生しません。空白のレコードが 1 つある空のテーブルビューだけです。