Any way to draw Core Graphics in the contentView of a UIScrollView
I was wondering if it was possible to draw any core graphics in the content view of a scroll view because at the moment, in the drawRect
section of the UIScrollView, it just draws on the static view and when I scroll the content view, the graphics stay still... (which means I'm not drawing in the right view)
Do I have to create another UIView subclass and draw there and add it to the UIScrollView, while handling the zooming and scrolling from the UIScrollView
or - is there a way I can keep it all in the one subclass of UIScrollView!
(I hope that makes sense!) thanks!
Typically, you don't draw in a UIScrollView directly. UIScrollView is just a container view which scrolls one content view or several tile views. You should add the content view(s) with addSubview:
and position them as needed. The scroll view will handle scrolling and zooming.
精彩评论