I would like to make my UIToolbar solid gray. This has to work for iOS 4.3+
I have subclassed my UIToolbar and added this
- (void)drawRect:(CGRect)rect {
UIGraphicsBeginImageContext(rect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSaveGState(ctx);
[[UIColor colorWithRed:64.0f/255.0f
green:64.0f/255.0f
blue:64.0f/255.0f
alpha:1.0f] set];
CGRect myRect = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
CGContextFillRect(ctx, myRect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
CGContextRestoreGState(ctx);
UIGraphicsEndImageContext();
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
No way. The toolbar is always black.
any clues?
thanks.