1

下图显示了我的问题 - 我想要一个撕纸效果,如此处所示,但是当我向上或向下滚动时,正如您在图像上看到的那样,撕纸也会移动 - 我希望它至少在用户使用时保持它的位置向上滚动。我该如何存档?

在此处输入图像描述

在此处输入图像描述

4

3 回答 3

1

使用导航栏shadowImage设置撕纸和阴影。您还必须设置栏的背景图像才能使其正常工作。如果图像很高,您可能也必须更改表格视图的偏移量。

于 2013-06-30T17:46:49.590 回答
1

更好的方法是将图像视图和表格视图添加到视图控制器并将图像设置为图像视图。tableview 背景视图应设置为 nil,背景颜色应设置为清除颜色。

- (void)viewDidLoad {
    [super viewDidLoad];
    UIImageView *backgroundImageView = [[UIImageView alloc] initWithFrame:self.view.frame];
    backgroundImageView.image = "Your image";
    [self.view addSubview:backgroundImageView];

    UITableView *tableView = [[UITableView alloc] initWithFrame:"Desired frame"];
    tableview.backgroundView = nil;
    tableView.backgroundColor = [UIColor clearColor];
    [self.view addSubview: tableView]; 
}
于 2013-06-30T17:57:58.400 回答
0

使用该backgroundView属性来实现您想要的效果。把它放在 viewDidLoad

self.tableView.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TableViewBackground.png"]];
于 2013-06-30T20:00:29.660 回答