title: CGContextFillRect not drawing a rectangle?
body: <p>I have this code:</p>
  
  <pre><code>CGColorRef darkColor = [[UIColor colorWithRed:21.0/255.0 green:92.0/255.0 blue:136.0/255.0 alpha:1.0] CGColor];
  CGContextRef context = UIGraphicsGetCurrentContext(); 
  CGContextSetFillColorWithColor(context, darkColor);
  CGContextFillRect(context, CGRectMake(18, 62, 66, 66));
  </code></pre>
  
  <p>And I just put it in the viewdidload method of my view, but my view doesn't look any different than before. I've tried making it really big and bright red, but it's just not drawing. Is there some other initialization code that I need?</p>
  
  <p>EDIT: After working with the answers given to me, I have this now in my veiwdidload:</p>
  
  <pre><code>[self.view addSubview:[[[imageBackground alloc] init] autorelease]];
  </code></pre>
  
  <p>and in imageBackground.m:</p>
  
  <pre><code>@implementation imageBackground
  
  - (id)initWithFrame:(CGRect)frame
  {
      self = [super initWithFrame:frame];
      if (self) {
          // Initialization code
          self.opaque = YES;
          self.backgroundColor = [UIColor clearColor];
      }
      return self;
  }
  
  
  // Only override drawRect: if you perform custom drawing.
  // An empty implementation adversely affects performance during animation.
  - (void)drawRect:(CGRect)rect
  {
      CGColorRef darkColor = [[UIColor colorWithRed:21.0/255.0 green:92.0/255.0 blue:136.0/255.0 alpha:1.0] CGColor];
      darkColor = [[UIColor colorWithRed:255.0 green:0.0 blue:0.0 alpha:1.0] CGColor];
      CGContextRef context = UIGraphicsGetCurrentContext();
      CGContextSetFillColorWithColor(context, darkColor);
      CGContextFillRect(context, CGRectMake(18, 62, 66, 66));
  }
  @end
  </code></pre>
  
  <p>Imagebackground.h subclasses UIView:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  @interface imageBackground : UIView
  @end
  </code></pre>
  
  <p>I still get no results out of it though.</p>
  
  <p>EDIT2: Well, I solved it myself, but then realized progrmr had already told me how to solve it. I had to use <code>[self.view addSubview:[[[imageBackground alloc] initWithFrame:CGRectMake(0, 0, 320, 480)] autorelease]];</code> instead of just plain alloc init.</p>
  
  <p>Thanks glorifiedhacker for lots of help as well!</p>