5
有没有人看到一个片段(或类/库),将绘制在桌子视图单元格中的角落三角形(见下图)。iPhone Tablview单元格 - 角三角形
有没有人看到一个片段(或类/库),将绘制在桌子视图单元格中的角落三角形(见下图)。iPhone Tablview单元格 - 角三角形
你可以从图像创建一个新的视图,然后将它添加到调用addSubview的单元中。下面是一个例子一经推出设置角落:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
CGRect cornerFrame = CGRectMake(x, y, width, height);
UIImageView * corner = [[UIImageView alloc] initWithFrame:cornerFrame];
[corner setImage:[UIImage imageNamed:@"corner.jpg"]];
[cell.contentView addSubview:corner];
}
return cell;
}
它可能只是一个在细胞图像。没有太花哨的东西,只是你自己的磨坊标准运行自定义UITableViewCell
这将无法正常工作...细胞得到重用,因此当你以这种方式实现它来添加很多这样的每个细胞。 –
这就是调用'addSubview'的例子。他可以在任何他想要的地方使用它。 – Dimme
在这个特定的地方,它会突破:)唯一比糟糕的代码示例更差的代码示例。 –