I'm subclassing UIView to make a custom view by overriding drawRect:. I need to find a point that is equal to 10 percent of the View's width. Of course, that distance is trivial to calculate (self.bounds.size.width/10.0f). I would like to cache this value, that is, I want to store this value in an instance variable to avoid having to calculate it on every single drawRect:.
Inside what method would I store this value? I was thinking about just saving the variable's value while in initWithFrame:, but then the cached value would be out of sync with the view's width after any sort of resize.
Any thoughts on what the best place to cache the view's width is... and if it is even ok to do so?