UITableView with Scrolling Wallpaper

I have a UITableView with the backgroundColor property set as follows:

tableview.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"IMAGE"]]; 

This gives the table a kind of background that scrolls, which is exactly what I want.

The problem is that when I add cells to the tableview , in each cell the background image of the tableview starts new / starts:

UIScrollView issue

In the above image you can see the problem in the red areas.

For tableview cells tableview I set all backgroundColors to clearColor for

  • backgroundView
  • textLabel
  • detailTextlabel
  • contentView

I also tried to install

 cell.backgroundView = [UIView new]; cell.backgroundView.backgroundColor = [UIColor clearColor]; 

and the same for contentView.

Additional note : Setting the backgroundView of the view table does not help, since then the background no longer scrolls!

+4
source share
2 answers

Just ran into this problem and found that this fixes a cell that has its own copy of backgroundColor

 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { [cell setBackgroundColor:[UIColor clearColor]]; } 
+3
source

Here is what I would do:

1) Create a view controller and set the background color of the view to the image.

2) Add the table view controller as the child view controller to the newly created view controller. This can be done in code, or if you are using iOS 6 and storyboards with built-in segue. If you do this in code, you may need to manually set the table controller frame.

3) Set the background color of your table view controller to [UIColor clearColor]

I had a similar problem and it helped me.

+1
source

All Articles