View Full Version : CGContextDrawImage and UIScrollView

Nov 26, 2009, 08:48 AM
In my iphone application, I have a UIScrollView wherein I am adding UIView dynamically. As I have to draw a chart in each UIView so as a part of this I am using CGContextDrawImage inside the drawRect method of UIView.
My problem is that the background image appears only in case of first UIView added. In subsequent UIViews the image does not appears
I am not able to get what is happening as same code is executing again for subsequent views.

UIImage* img = [ UIImage imageNamed:@"bg_graph.png"];
CGContextDrawImage(context, self.frame, img.CGImage);