2023年7月14日发(作者:)
UITableViewCell的分割线样式默认UITableViewCell是留有图标区域的,但是要是不加图标,就会在左边留有⼀段空间,很不好看。所以,我们定义⼀个UITableViewCell的⼦类,在.m的实现⾥填上下边这段⽅法,给它画⼀个分割线。-(void)drawRect:(CGRect)rect{ [super drawRect:rect]; CGContextRef cxt = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(cxt, 0.5); CGContextSetStrokeColorWithColor(cxt, [UIColor colorWithWhite:0.910 alpha:1.000].CGColor); CGContextMoveToPoint(cxt, 0.0 , - 0.5); CGContextAddLineToPoint(cxt, , - 0.5); CGContextStrokePath(cxt);}千万记得在UITableView上关掉原本的Cell分割线样式[iew setSeparatorStyle:UITableViewCellSeparatorStyleNone];
发布者:admin,转转请注明出处:http://www.yc00.com/news/1689265542a226471.html
评论列表(0条)