如何在UItabViewController 使用自定义UitabViewCell
在UitableViewController 用自定义的UItableViewCell 初始化,他怎么都不走- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 这个方法
@interface CustomTableViewController ()
@property (nonatomic , strong)LeftTableViewCell *leftCell;
@end
@implementation CustomTableViewController
- (instancetype)initWithCustomCell:(NSString *)customCellName imageArray:(NSMutableArray *)imageArray textArray:(NSMutableArray *)textArray textDetailArray:(NSMutableArray *)detailArray {
self = [super init];
if (self) {
customCellName = _Customcell;
if (_Imagearray) {
imageArray = _Imagearray;
}
if (_textArray) {
textArray = _textArray;
}
if (_textDetailArray) {
detailArray = _textDetailArray;
}
}
self.tableView.rowHeight = 80;
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self.tableView registerClass:[LeftTableViewCell class] forCellReuseIdentifier:@"customCell"];
self.tableView.delegate = self;
self.tableView.dataSource = self;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return _textArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// Class TableCell = NSClassFromString(_Customcell);
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"reuseIdentifier" forIndexPath:indexPath];
if (!cell) {
cell = _leftCell;
}
// UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
[_leftCell setcell:_Imagearray[indexPath.row] titleString:@"hhhhhhhh"];
// cell.imageView.image = [UIImage imageNamed:_Imagearray[indexPath.row]];
// cell.backgroundColor = [UIColor whiteColor];
return cell;
}