Here is the scenario...
I have a view controller called 'SecondView' in which I have a UIScrollView (1280x460 giving me 4 horizontal 'pages') whose handle is 'scroll'.
I wish to draw several small rectangles in the scrollView. I looked at Quartz and put the following code into SecondViewController.m hoping the drawRect method would automatically be called.
I tried calling it manually but to no avail in viewDidLoad.
I didn't do anything else or add any other code. I don't understand this aspect of app development (drawing shapes, etc.) enough to make this work. Do I need to import a 'quartz' framework or am I missing something important in the code?
I have a view controller called 'SecondView' in which I have a UIScrollView (1280x460 giving me 4 horizontal 'pages') whose handle is 'scroll'.
I wish to draw several small rectangles in the scrollView. I looked at Quartz and put the following code into SecondViewController.m hoping the drawRect method would automatically be called.
Code:
- (void) drawRect{
CGContextRef contextRef = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(contextRef, 0, 0, 1.0, 1.0);
CGContextSetRGBStrokeColor(contextRef, 0, 0, 1.0, 1.0);
// Draw a circle (filled)
CGContextFillEllipseInRect(contextRef, CGRectMake(100, 100, 25, 25));
// Draw a circle (border only)
CGContextStrokeEllipseInRect(contextRef, CGRectMake(100, 100, 25, 25));
}
I tried calling it manually but to no avail in viewDidLoad.
I didn't do anything else or add any other code. I don't understand this aspect of app development (drawing shapes, etc.) enough to make this work. Do I need to import a 'quartz' framework or am I missing something important in the code?