Así que estoy tratando de anular drawRect en mi UIScrolLView, sin embargo, me da este fondo negro en lugar del color de fondo que he especificado para mi UIScrollView. ¿Por qué es esto? Si quito el código drawRect entonces todo está bien:fondo negro al anular drawRect en UIScrollView
- (void)drawRect:(CGRect)rect
{
[super drawRect:rect];
if (shouldDrawVerticalLineForProfile){
CGContextRef context = UIGraphicsGetCurrentContext();
CGColorRef separatorColor = [UIColor colorWithRed:47.0/255.0 green:47.0/255.0
blue:47.0/255.0 alpha:1.0].CGColor;
// Add at bottom
CGPoint startPoint = CGPointMake(60, 0);
CGPoint endPoint = CGPointMake(60, 10000);
CGContextSaveGState(context);
CGContextSetLineCap(context, kCGLineCapSquare);
CGContextSetStrokeColorWithColor(context, separatorColor);
CGContextSetLineWidth(context, 5.0);
CGContextMoveToPoint(context, startPoint.x + 0.5, startPoint.y + 0.5);
CGContextAddLineToPoint(context, endPoint.x + 0.5, endPoint.y + 0.5);
CGContextStrokePath(context);
CGContextRestoreGState(context);
}
}
Creo que la propiedad backgroundColor simplemente se ajusta un CGContextAddRect y CGContextFillPath, lo que si haces algo por el estilo? –
hacer algo como qué? – xonegirlz
dibujando el bgcolor manualmente usando las dos funciones que mencioné anteriormente. –