0

我正在为我的待办事项列表应用程序构建一个滑动功能。当用户水平滑动(拖动)单元格时,我想显示一个背景图像,覆盖屏幕边缘和单元格边缘之间的间隙。

当我将图像添加到 imageView-property 时,它只是跟随单元格。我可以以某种方式修复它以覆盖整个背景吗?

4

1 回答 1

0

听起来你想做类似Clear的东西。

您需要做的是:

  • 子类UITableViewCell
  • 像这样添加您的图像视图..

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.bounds];
    imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
    imageView.image = myImage;
    [self insertSubview:imageView atIndex:0]; //I'm not at a compiler, so I'm not 100% on this, but it's something like this.
    
  • 添加一个UIGestureRecognizer来处理手势,并设置拖动和适当的操作。

于 2013-04-17T03:16:51.317 回答