在创建UITableView处,调用tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
在自定义cell的.m文件加入下面的代码
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
CGContextFillRect(context, rect);

本文介绍如何在iOS开发中自定义UITableView的分隔线,包括设置颜色、粗细以及与屏幕边缘的距离。首先将tableview的separatorStyle设为None,然后在自定义cell的drawRect方法中使用CGContext进行绘制,分别画出上、下分割线。
最低0.47元/天 解锁文章
381

被折叠的 条评论
为什么被折叠?



