- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
CellIdentifier];
if (0 == indexPath.section) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier] autorelease];
if (0 == indexPath.row) {
cell.textLabel.text = @"新浪微博"; //cell的text内容
UIView *lbl = [[UIView alloc] init]; //定义一个label用于显示cell之间的分割线(未使用系统自带的分割线),也可以用view来画分割线
lbl.frame = CGRectMake(cell.frame.origin.x + 10, cell.frame.size.height - 5, cell.frame.size.width - 20, 1);
lbl.backgroundColor = [UIColor lightGrayColor];
iOS开发笔记--cell最右边显示箭头,字符,自定义分割线
最新推荐文章于 2021-06-24 14:29:03 发布
这篇博客介绍了如何在iOS开发中自定义UITableViewCell,包括在cell最右边显示箭头、字符以及使用自定义的分割线。通过初始化UITableViewCell,设置不同section和row的样式,例如在第一行显示特定文字并添加自定义分割线,以及在另一行显示右向指示箭头。代码示例详细展示了实现这些效果的方法。
摘要由CSDN通过智能技术生成