Hi everyone,
I'm trying to implement a custom UIView that mimics the behavior of UIScrollView for some reason. And the question is how can I show the proper part of the content which is represented by the contentOffset property?
I've analyzed UIScrollView and found that it doesn't adopt any inbetween sublayers or manipulate the bounds and transform properties to apply the offset. I've overridden the UIView's drawRect: method as follows but it didn't work:
- (void)drawRect: (CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(context, -content_offset_.x, -content_offset_.y);
}
So my question is how does UIScrollView show the proper part of its content? Should I override the layer's display method or else? Any suggestions would be appreciated! And please don't ask 'why do you want to do anything like that in the first place?' :D
Thanks!