obe*_*aum 6 iphone tableviewcell ios
有没有人看过会在tableview单元格中绘制角落三角形的片段(或类/库)(见下图).

您可以从图像创建一个新视图,然后将其添加到调用 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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
505 次 |
| 最近记录: |