Reputation: 9596
I am exploring the idea of drawing some custom primitives (using CGContext) on a view that is scrollable and larger than the phone screen width.
The idea would be to use the "power" of a UIScrollView by programmatically scrolling the content of the view as the content is added and decouple in this way the scrolling handling (and general UI interaction with the view) from the content drawing.
Is this a feasible approach in iOS?
Upvotes: 2
Views: 284
Reputation: 8006
Yes it is. The easiest approach AFAIK would be to add a UIView
onto the UIScrollView
. You would then draw on that UIView
instance - after drawing another part of your graph/image you would need to inform the containing scroll view, via a delegate for example, that it needs to update its contentSize
. This would of course be the size of the UIView
upon which you drew. The update is needed, beacuse it seems that you may need to increase your drawing area size as you do it.
Upvotes: 2