You should implement your own UIView's method
- (void)drawRect:(CGRect)rect
The default implementation of this method does nothing. Subclasses that use technologies such as Core Graphics and UIKit to draw their view’s content should override this method and implement their drawing code there
You should receive something like
- (void)drawRect:(CGRect)rect
{
CGRect frame = self.bounds;
// Set the background color
[[UIColor redColor] set];
UIRectFill(frame);
// Set the second color
[[UIColor greenColor] set];
UIRectFill(CGRectMake(250, 0, 50, 50));
}