去掉/自定义 UITableViewCell分割线方法

去掉/自定义 UITableViewCell分割线方法 

1.设置TableView样式

//1设置table样式
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

2.自定义UITableViewCell

#import "SettingTableViewCell.h"
#import "AppHelper.h"

@implementation SettingTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
    CGContextFillRect(context, rect);
    
    //上分割线,
    //CGContextSetStrokeColorWithColor(context, [UIColor colorWithHexString:@"ffffff"].CGColor);
    //CGContextStrokeRect(context, CGRectMake(5, -1, rect.size.width - 10, 1));
    //    [UIColor colorWithHexString:@"e2e2e2"].CGColor
    //下分割线
    CGContextSetStrokeColorWithColor(context, UIColorFromRGB(DisEnableColor).CGColor);
    CGContextStrokeRect(context, CGRectMake(0, rect.size.height, rect.size.width, 1));
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end

猜你喜欢

转载自huqiji.iteye.com/blog/2337121
今日推荐