Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

background color using core graphics

I have the following code in my drawRect:

CGContextSetFillColorWithColor(context, [UIColor redColor].CGColor);
CGContextFillPath(context);

I basically wanted to set the background of this view to be red.. however the code above doesn't do it. What am I doing wrong?

like image 749
adit Avatar asked Jan 14 '23 19:01

adit


1 Answers

An easier way to change the background color of a view is:

view.backgroundColor = [UIColor redColor];

Or if you are in the view controller:

self.view.backgroundColor = [UIColor redColor];
like image 84
PaulPerry Avatar answered Jan 20 '23 04:01

PaulPerry