I'm drawing a grid of data in a UIView with drawRect
, of which I won't know the final size when the UIView is created because the number of columns and rows is dynamic. Sure I could do the calculations before creating the UIView, but that doesn't really make sense, because I'll also be doing those calculations in the UIView subclass, and would rather not have to extract that.
So how do I handle this? Do I init with a very large frame and adjust it after drawRect is done?
I will also be setting this view as the content of a UIScrollView in case its too large to be viewed in the area allotted for it.
The view I'm going to be drawing looks something like this: