Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

foges

macrumors newbie
Original poster
May 5, 2009
13
0
Hello people, Im an absolute newb here but anyways. I created a new view based application and pasted the following code into the ViewController.m file, what else do i need to do to get it to display:

Code:

Code:
- (void)drawRect:(CGRect)rect
{
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextClearRect(ctx, rect);
}

Im sorry for the simple question, but i cant seem to find any good CG tutorials
 
oops sorry, incomplete code, here is what i meant to post:

Code:
-(void)drawRect:(CGRect)rect
{
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextClearRect(ctx, rect);
	CGContextSetRGBFillColor(ctx, 255, 0, 0, 1);
    CGContextFillRect(ctx, CGRectMake(10, 10, 50, 50));
}

Thanks ill check out that link
 
Look at the quartz demo example code and then look at the quartz docs. A view controller doesn't get drawn. Only views get drawn.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.