I've been trying to link my tableviewcell to my tableview which is in a UIView through my uiviewcontroller. Although the tableview is there, my custom tableviewcell is not loading. Log is showing Cell is initialized and populated
Here are the codes that I use in the viewcontroller while the tableview is already setup in a UIView
viewcontroller.m
- (void)viewDidLoad {
[super viewDidLoad];
barcodeItems = [NSArray arrayWithObjects:@"Monday", @"Tuesday", @"Wednesday", @"Thursday", @"Friday", @"Saturday", nil];
NSLog(@"%@", barcodeItems);
[photoCaptureView.itemsTableView registerNib:[UINib nibWithNibName:@"BarcodeItemsTableViewCell" bundle:nil] forCellReuseIdentifier:@"BarcodeItemsCell"];
photoCaptureView.itemsTableView.rowHeight = 60;
photoCaptureView.itemsTableView.dataSource = self;
photoCaptureView.itemsTableView.delegate = self;
}
#pragma mark UITableViewDataSource methods
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return barcodeItems.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"Cell Initialized");
static NSString *cellIdentifier = @"BarcodeItemsCell";
BarcodeItemsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
if (cell == nil) {
cell = [[BarcodeItemsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
// Configure the cell...
NSLog(@"Cell Populated");
cell.barcodeLabel.text = @"TEST";
UIImage *btnImage = [UIImage imageNamed:@"barcodeIcon"];
[cell.leftButton setImage:btnImage forState:UIControlStateNormal];
return cell;
}