0

I have a UIViewController with a UIImage as the entire background image. I put a UITableView into my view controller and constraint it to the bottom, leading, trailing and half the height.

The goal is to make the Section Header of the table view be completely transparent so that the background image is visible through the section header.

Doing this just makes it gray and not clear/transparent:

self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.opaque = NO;

How can I make it transparent?

Vvk
  • 4,031
  • 29
  • 51
Anish Kumar
  • 1,465
  • 16
  • 20
  • Your question title makes it sound like you're asking about the section, when you are actually asking about the section header. – Ben Wheeler Jun 19 '15 at 18:47

1 Answers1

1

If you declared your tableHeader view using self.tableView.tableHeaderView = YourHeaderView;

Update it by

UIView *tempTableView = self.tableView.tableHeaderView;

then modify it by: tempTableView.backgroundColor = [UIColor clearColor];

of directly like: self.tableView.tableHeaderView.backgroundColor = [UIColor clearColor];

but if you are using UITableView Delegate:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

your need to update it by:

UIView *tempTableView = [self.tableView viewForHeaderInSection:YourSection];

then modify: tempTableView.backgroundColor = [UIColor clearColor];

svilla
  • 11
  • 3
0yeoj
  • 4,500
  • 3
  • 23
  • 41