前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >iOS tableViewCell最右边显示箭头,字符,自定义分割线

iOS tableViewCell最右边显示箭头,字符,自定义分割线

原创
作者头像
Lee坚武
修改2020-10-14 17:40:30
1.5K0
修改2020-10-14 17:40:30
举报
文章被收录于专栏:iOS知识点iOS知识点

效果如图:

![image.png](https://upload-images.jianshu.io/upload_images/659494-f8437106309f11fc.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

1.添加iOS系统自带的cell的箭头

```

cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;

```

2.去掉tableviewcell的间隔下划线

```

_tableView.separatorStyle=UITableViewCellSeparatorStyleNone;

```

3.添加自定义间隔线,加在下面的这个方法里面

```

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

//这里

}

```

如下:

```

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

UIView*lbl = [[UIViewalloc]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=  [UIColorlightGrayColor];

[cell.contentViewaddSubview:lbl];

}

```

转载:

1.[iOS:tableViewCell最右边显示箭头,字符,自定义分割线](https://www.jianshu.com/p/bdfcaa20383d)

2.[iOS TableView去掉最后一行Cell的分割线](https://blog.csdn.net/feiyue0823/article/details/104520782)

3.[IOS TableView去掉最后一个cell分割线简单方法](https://www.jianshu.com/p/a84bfe816c9e)

4.[iOS自定义TableView的Cell点击事件](https://www.jianshu.com/p/6c659b7f0f0a)

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档