1

在我的应用程序中,我有 UITableViewController,上面有表格。我以这种方式用图像填充背景:

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

但是,当用户滚动表格时,背景会随着所有其他视图控制器组件移动。

是否有可能制作不可移动的背景,如 HTML 背景?

谢谢。

4

1 回答 1

2

尝试

UIColor *color= [[[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"Background.png"]] autorelease];
self.tableView.backgroundColor = color;

或者

UIImageView *imageView= [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Background.png"]] autorelease];
imageView.frame = self.tableView.frame

self.tableView.backgroundView = imageView;
于 2013-04-13T18:03:12.343 回答