//不画分割线
tvDailySetting . separatorStyle = UITableViewCellSelectionStyleNone ;
tvDailySetting . separatorStyle = UITableViewCellSelectionStyleNone ;
//自绘分割线
-(void) drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
CGContextFillRect(context, rect);
CGContextSetStrokeColorWithColor(context, [UIColor colorWithRed:1/255.0f green:1/255.0f blue:1/255.0f alpha:1].CGColor);
CGContextStrokeRect(context, CGRectMake(15, rect.size.height, rect.size.width-30, 1));
}
本文介绍如何在iOS应用中使用Objective-C来自定义UITableViewCell的分割线样式。通过设置tvDailySetting.separatorStyle为UITableViewCellSelectionStyleNone取消默认分割线,并通过drawRect方法绘制自定义颜色和位置的分割线。
1699

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



