您的位置:首页 > 产品设计 > UI/UE

iOS 自定义UITableViewCell的分割线

2016-07-19 11:19 435 查看
- (void)drawRect:(CGRect)rect

{

    CGContextRef context = UIGraphicsGetCurrentContext();

    

    CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);

    CGContextFillRect(context, rect);

    

    //上分割线,

    CGContextSetStrokeColorWithColor(context,SET_COLOR(225,225,
225).CGColor);

    CGContextStrokeRect(context, CGRectMake(0, -0.5, rect.size.width,0.5));

    

    //下分割线

    CGContextSetStrokeColorWithColor(context, SET_COLOR(225,225,
225).CGColor);

    CGContextStrokeRect(context, CGRectMake(0, rect.size.height, rect.size.width,0.5));

}

这是一个方法,直接在继承与UItableViewCell的类中声明,就可以了,,简单明了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: