I just want to draw a rect on a view. This is my code in my UIView subclass:
- (void)drawRect:(CGRect)rect
{
context = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(context, 255.0/255.0, 0.0/255.0, 0.0/255.0, 1);
CGContextAddRect(context, (CGRectMake(20, 20, 20, 20)));
}
When I run it no rect is drawn. What's wrong?