Fix cell background in iOS7

This commit is contained in:
Guillaume BIENKOWSKI 2013-10-04 17:13:23 +02:00
parent 518dd9e9c7
commit dd5e1d7245

View file

@ -122,7 +122,9 @@ static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWi
- (void)drawRect:(CGRect)aRect {
// Drawing code
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextRef c = UIGraphicsGetCurrentContext();
// don't use arcs on iOS >= 7
BOOL use_arcs = [[[UIDevice currentDevice] systemVersion] floatValue] < 7;
int lineWidth = 1;
@ -140,8 +142,8 @@ static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWi
CGContextSetLineWidth(c, lineWidth);
CGContextSetAllowsAntialiasing(c, YES);
CGContextSetShouldAntialias(c, YES);
if (position == UACellBackgroundViewPositionTop) {
if (position == UACellBackgroundViewPositionTop && use_arcs) {
miny += 1;
@ -166,7 +168,7 @@ static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWi
CGContextStrokePath(c);
CGContextRestoreGState(c);
} else if (position == UACellBackgroundViewPositionBottom) {
} else if (position == UACellBackgroundViewPositionBottom && use_arcs) {
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, minx, miny);
@ -190,8 +192,8 @@ static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWi
CGContextRestoreGState(c);
} else if (position == UACellBackgroundViewPositionMiddle) {
} else if (position == UACellBackgroundViewPositionMiddle || !use_arcs) {
// in iOS7, this will be the default handling
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, minx, miny);
CGPathAddLineToPoint(path, NULL, maxx, miny);