Making a TableViewCell Section Footer Transparent

clifgray

I am trying to make a section footer of a UITableViewCell transparent and this is what I am doing right now:

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    UIColor *background = [UIColor clearColor];

    UIImageView *imageView = [[UIImageView alloc] initWithImage:(UIImage *)background];
    imageView.frame = CGRectMake(10,10,1,30);

    return imageView;
}

But I am getting a problem from casting background to a UIImage. Is this possible in this way, is there a better way to cast it or am I simply going about this wrong? I am basically using the footer as a way to create a clear spacer between cells. Need some guidance on this.

Jim Tierney

This code will add clear footer to your section, where you can set the desired height to whatever you need. Below it has been set to 30, to match your code in the question.

-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{

    UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 30)];
    footerView.backgroundColor = [UIColor clearColor];

    return footerView;
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related