I’m trying to implement an owner-drawn view that is a subclass of UIScrollView. Basically, I want to custom-draw the contents of the view, and then have the stuff I’ve drawn be scrollable.
I’ve overridden drawRect in my view and I’m able to draw my contents, scaled to the size of the UIScrollView’s contentSize property (so some of my custom drawing is not visible, as I intended).
The problem is that the content then never moves. I can drag my finger up and down, and this makes the UIScrollView’s scrollbars appear, but my custom-drawn content never moves or changes – I still always only see the top half.
How can I custom-draw content for this UIScrollView so that what I’ve drawn is scrollable?
Are you calling
[super drawRect];at the end of your owndrawRectmethod?Edit
I misread the question. You’ll need to create your own
UIViewsubclass and put your overriddendrawRectin that. Then, add that view as a child of theUIScrollView.