In My Application I've subclassed the UIScrollView
and draw horizontal Lines in the drawRect
method
I set the height the ContentSize
greater than the height of scrollView
. I use below method to draw the lines
But my problem is that the lines I have drawn is not scrolling with View.
-(id)initWithFFrame:(CGRect)rect
{
_gap=36;
}
- (void)drawRect:(CGRect)rect
{
// Drawing code
int end=0;
NSLog(@"called");
int x=self.frame.size.width;
while (end<self.contentSize.height) {
CGContextRef context=UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 1);
CGContextSetStrokeColorWithColor(context, [UIColor blackColor].CGColor);
CGContextMoveToPoint(context, 0, end);
CGContextAddLineToPoint(context, x, end);
CGContextStrokePath(context);
end=end+_gap;
}
}
I can notice the scroller moving up and down when scrolling but the lines are not moving.