Implementing multiple views in a scrollview after 'drawRect'
I have a scrollview that should contain multiple subviews.
The content of each view needs to be created during 'drawRect' and the content of each view depends on the content of the view before it.
e.g. I have 5 subviews, view1 draws as much as it can, then view2 will draw its content based on the content (text) that did not fit in to the previous view.
I thought of a couple of ways to do this but none seem to work correctly:
1.) Implement all the drawing in one very long view. Here I am not sure what to do about setting the width of the frame as I will only know this once that drawing has completed.
2.) Add a delegate to the view drawing itself and call back to its superview when drawing has completed. The superview may then send itself a notification/delayed call/immediate call(?) to add the next view.
This works fine the first time and crashed the second...
Any suggestions appreciated.
|