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

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -