小编vbw*_*bwx的帖子

重叠UITableViewCell内容视图

我有这个表,其单元格如下所示: UITabelViewCell
如您所见,每个单元格的顶部边框应该与上面的单元格重叠.现在,这个边框是背景的一部分(到目前为止没有重叠).

现在,我将边框与背景分开,我的单元格创建代码如下所示:

#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; …
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch uikit ios

2
推荐指数
1
解决办法
5256
查看次数

标签 统计

cocoa-touch ×1

ios ×1

iphone ×1

uikit ×1