views:

478

answers:

2

I have a view hierarchy as a subview of a UIScrollView instance. The view hierarchy uses a simple container view as a wrapper around a horizontal row of subview tiles each of which is a UIView subclass that overrides drawRect. Nothing fancy.

As a sanity check I echo the bounds, frame, and transform of each subview tile. To my astonishment each of these remains unchanged during zooming! This is a BIG problem because I intend to redraw each tile after a zoom sequence is completed. Without correct dimensions this is impossible.

How on earth are we supposed to do custom drawing using Quartz in these tiles if they have completely incorrect dimentsions.

Could someone please enlighten me. Thanks.

Cheers,

Doug

A: 

I may be wrong, but those are just the logical dimensions; they would be scaled, rotated and deformed depending on the transform the UIScrollView has put on them. The display context should also be deformed similarly and thus it should be business as usual for the drawRect: method.

rpetrich
For clarity, I am echoing self.bounds, self.frame, and self.transform in the overridden drawRect:rect method of each of the subview "tiles". Unless these properties each have accurate pixel dimensions it is impossible to correctly render the contents of each tile. What do you mean by "logical dimensions"? Bounds, frame, and transform are the fundamental geometric properties that define the location and orientation of a UIView on the screeen.
dugla
A: 

UPDATE

Problem solved. I had forgotten to take into account that coordinate frame under consideration. By inspecting the superviews frame/bounds/transform they are indeed changing during zoom. Subview draw takes place in local coords and is then scaled by the parent transform.

Nothing to see here, move along.

Cheers,

Doug

dugla