I created a FeatureCell custom cell that has 5 images per row that will be called in the main view, but when I call it, I get an empty row. So please, where is my problem?
I have googled about a custom cell, and I used what I need to use in the code below, but nothing happens.
This is my FeatureCell.h
@interface FeatureCell : UITableViewCell{ IBOutlet UIImageView *img1; IBOutlet UIImageView *img2; } @property (nonatomic, retain) UIImageView *img1; @property (nonatomic, retain) UIImageView *img2; @end
This is my FeatureCell.m
@implementation FeatureCell @synthesize img,img1,img2,img3,img4; @end
This is my view-controller.m
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView{ return 2; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ if (section == 0) { return [objectCollection count]; } else{ return 1; } } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString* cellIdentifier1 = @"FeatureCell"; FeatureCell *cell1 = (FeatureCell*)[tableView dequeueReusableCellWithIdentifier:cellIdentifier1]; if (cell1 == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:cellIdentifier1 owner:nil options:nil]; cell1 = (FeatureCell*)[nib objectAtIndex:0]; } static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier]; } if ([indexPath section] == 0) { containerObject = [objectCollection objectAtIndex:indexPath.row]; [[cell textLabel] setText:containerObject.store]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } else{ cell1.img1.image = [UIImage imageNamed:@"shower.png"]; cell1.img2.image = [UIImage imageNamed:@"parking.png"]; } return cell; }
source share