I have a subclass of UITableViewCell with the following implementation of drawRect: He will draw a line at the bottom of the cell, drawing 30 points off to fit our design. tableView.separatorStyle installed instead UITableViewSeparatorStyleNone instead of the user drawing.
- (void)drawRect:(CGRect)rect { [super drawRect:rect]; if (!_hideBottomLine) { CGContextRef ref = UIGraphicsGetCurrentContext(); CGContextSetShouldAntialias(ref, NO); CGContextSetStrokeColorWithColor(ref, [UIColor colorWithWhite:0.75 alpha:1].CGColor); CGContextSetLineWidth(ref, 1); CGContextMoveToPoint(ref, 30, CGRectGetMaxY(rect)); CGContextAddLineToPoint(ref, CGRectGetMaxX(rect), CGRectGetMaxY(rect)); CGContextStrokePath(ref); } }
This worked fine in iOS 6 and iOS 7 when building with the iOS 6 SDK. Now when I build with the iOS 7 SDK, the line does not appear.
Did I miss some changes using the CG drawing in the iOS 7 SDK?
EDIT:
So now I understand that there is a better way to do this in iOS 7 using cell.separatorInset , I also found some other similar CG code that I wrote that works. Therefore, I think the problem is isolated from the implementation of drawRect: on UITableViewCell
Nevertheless, I would like to receive an answer on how to make an individual drawing on a cell in iOS 7.
source share