Перекрывающиеся представления контента UITableViewCell

У меня есть эта таблица, чьи клетки выглядят так: UITabelViewCell
Как видите, верхняя граница каждой ячейки должна перекрываться с ячейкой выше. Прямо сейчас эта граница является частью фона (пока не перекрывается).

Теперь я отделил границу от фона, и мой код создания ячейки выглядит следующим образом:

<code>#define QAImage(NAME) [[[UIImageView alloc] initWithImage:[UIImage imageNamed:NAME]] autorelease]

- (UITableViewCell*) tableView:(UITableView*)table cellForRowAtIndexPath:(NSIndexPath*)index
{
    UITableViewCell *cell = [table dequeueReusableCellWithIdentifier:@"Entry"];
    if (cell == nil)
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                         reuseIdentifier:@"Entry"] autorelease];
        cell.backgroundView = QAImage(@"bg-cell.png");
        cell.selectedBackgroundView = QAImage(@"bg-cell-sel.png");
        cell.selectionStyle = UITableViewCellSelectionStyleGray;
        UIImageView *img = QAImage(@"disclosure.png");
        img.highlightedImage = [UIImage imageNamed:@"disclosure-sel.png"];
        cell.accessoryView = img;
        CGRect r = cell.frame;
        r.size.height = table.rowHeight;
        r.size.width = table.frame.size.width;
        cell.frame = r;
        r = cell.contentView.frame;
        r.origin = CGPointMake(13, 13);
        r.size.width -= 8 + img.frame.size.width;
        r.size.height -= 25;
        [cell.contentView addSubview:[[[TagView alloc] initWithFrame:r] autorelease]];
        img = QAImage(@"cell-top.png");
        img.highlightedImage = [UIImage imageNamed:@"cell-top-sel.png"];
        img.opaque = NO;
        r = img.frame;
        r.origin = CGPointMake(0, 1 - r.size.height); // The (supposed) overlapping happens here.
        img.frame = r;
        cell.contentView.clipsToBounds = NO;
        [cell.contentView addSubview:img];
    }
    // Here I set the title. (omitted)
    return cell;
}
</code>

Проблема в,the border is only shown when I'm scrolling up in the tableиначе он сам перекрывается клеткой над ним. (Неправильный путь.)

Я пытался[cell setNeedsDisplay] в-tableView:willDisplayCell:forRowAtIndexPath:, добавив границу (cell-top.png) каждый раз, когда запрашивается ячейка (что, очевидно, приводит к многократному рисованию и не выглядит хорошо; независимо от того, что это все еще не решает мою проблему) и настройкаimg.layer.zPosition = 2.

Как я могу заставить этот UIImageView оставаться на вершине все время?

Ответы на вопрос(1)

Ваш ответ на вопрос