2011-06-27 153 views
2

我注意到的東西: 我和一個自定義背景的的UITableViewController,這樣設置的:UITableView背景現在滾動細胞?

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

在iPhone模擬器4.1,背景正確地顯示,固定和移動從未... 但是,當我使用iPhone模擬器4.2或4.3,背景是與細胞滾動! 我想這是蘋果在iOS 4.2上做出的改變,但如何避免這種情況?

回答

6

將tableView的backgroundView設置爲UIImageView會導致圖像保持固定位置。

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

當我在背景上設置自定義視圖時,它滾動 –