去掉/自定義 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

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章