I am a bit confused between different version of iOS SDK and information on the net. So I am not sure how I am supposed to draw a filled rectangle in case of iOS 6 SDK. Can anyone guide me to find an answer?
Asked
Active
Viewed 3,437 times
2
-
2Can you describe what makes you confused? – Macmade May 06 '13 at 08:58
-
Any way that works is a correct way, checkout this :http://stackoverflow.com/questions/8195095/how-to-draw-rectangle or http://stackoverflow.com/questions/15082699/drawing-a-rectangle-in-uiview – Mr.Me May 06 '13 at 08:58
-
How u have drawn rect by using CGContext or using UIBezierPath? – CRDave May 06 '13 at 09:00
1 Answers
5
There are various ways. You could try something like:
-(void)drawRect:(CGRect)rect
{
CGContextRef cont = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(cont, 1.0, 1.0, 0.0, 1.0);
CGContextFillRect(cont, CGRectMake(50.0, 50.0, 50.0, 50.0));
}

Robert
- 5,278
- 43
- 65
- 115