0
votes

Screenshot below shows one tableview cell in editing mode after swiping to the left on the row. While in editing mode I can hold the cell and drag further to the left again which reveals this white space (bouncy effect when I let go). I'm setting each cell's background image as follows:

cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"CellBG.jpg"]];

I have 2 questions.

  1. Is it possible to prevent this extra dragging so this white area will never be seen? Would like the same behaviour as the iOS7 weather app for example.
  2. Also, any idea why there is thin white line under the delete button?

Thanks

Screenshot

1

1 Answers

2
votes
  1. Is it possible to prevent this extra dragging so this white area will never be seen?

Yes. Put the image on the UITableView's background. Not on the cell. Because if you put the image background on a cell and when you horizontally swap a cell to delete, that cell will move. That is to say the image background will also move. But if you put it on the UITableView, it will not move with the swap. Remember to set UITableView and UITableViewCell's background color to be clear color.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ReuseIdentifier"];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cellBackground.png"]];
    imageView.frame = CGRectMake(0, kCellHeight*indexPath.row, 320, cell.frame.size.height);
    [tableView addSubview:imageView];
    [tableView sendSubviewToBack:imageView];
    return cell;
}

2.Also, any idea why there is thin white line under the delete button?

I think that is Apple's little bug. As you can also find it in the weather app. So never mind that.