ingham
ingham

Reputation: 1645

UITableView background now scrolling with cells?

I've noticed something: I've an UITableViewController with a custom background, set this way:

UIImage *backgroundImage = [UIImage imageNamed:@"background.png"];
self.view.backgroundColor = [UIColor colorWithPatternImage:backgroundImage];

On iPhone Simulator 4.1, the background shows correctly, fixed and never moving... But when I use iPhone Simulator 4.2 or 4.3, the background is scrolling with the cells ! I suppose this is a change made by Apple on iOS 4.2, but how to avoid this ?

Upvotes: 2

Views: 1609

Answers (1)

Gordon McCreight
Gordon McCreight

Reputation: 2659

Setting the backgroundView of the tableView to a UIImageView results in an image that remains in a fixed position.

UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background"]];
self.tableView.backgroundView = backgroundImageView;
[backgroundImageView release];

Upvotes: 6

Related Questions