views:

1287

answers:

2

There are currently a lot of answers on how to set a custom fixed background for a UITableView. But is there any trick to make the background image scroll together with the table cells?

Thanks!

A: 

.

UIImageView *background = [[UIImageView alloc]initWithImage: [UIImage imageNamed: @"background.jpg"]];
    [tableView addSubview: background];
    [tableView sendSubviewToBack: background];
oxigen
Thanks, tried it, but I think the sendSubviewToBack message doesn't work as it should in this case: the UIImageView gets positioned above the cells. Any clues?
Stefano Verna
+1  A: 

The answer was -- obviously -- already on stackoverflow:

self.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @"desk.png"]];

Ref: http://stackoverflow.com/questions/898351/iphone-setting-background-on-uitableview

Stefano Verna
That will use parts of the background in each cell. So if you have background image higher then one cell that won't work.
OgreSwamp