Do what @rmaddy and @rdelmar have suggested but since you're using a custom cell anyways, the quickest way, imho, would be:
- Add this line to the cell's
contentView
via the Interface Builder directly@property (strong, nonatomic) IBOutlet UIView *vwLine;
- also
@synthesize vwLine;
- also
- Set it's frame, background color & alpha value (obviously)
- Set it's
hidden
property toYES
- When you do the
imageString != [NSNull null]
check- if TRUE then
[cell.vwLine setHidden:NO];
- if TRUE then
Example:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCell"
owner:self
options:nil];
cell = [topLevelObjects objectAtIndex:0];
}
if (imageString != [NSNull null]) {
[cell.vwLine setHidden:NO];
}
}