ios - Resizing UIView from drawRect() -
i have uiview , drawing content drawrect()
, need resize view depending on calculation done during drawing:
when change size, drawing seams scale , not use additional size gained resize.
this how i'm resizing form drawrect()
cgrect limits = self.frame ; limits.size.width = 400; self.frame = limits;
it seams context not aware of resize , drawing using old sizes. try [self setneedsdisplay]
after resizing draw method not called again.
calculations should done ahead of time , not during drawing, performance reasons alone (though calculations avoid problem).
for example, if calculations depend on factors x
, y
, z
, arrange redo calculations whenever there change x
, y
or z
. cache results of calculation if necessary, , resize view frame @ time. drawrect:
implementation should draw area given.
Comments
Post a Comment