Scroll View School · Centering Content | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/9223-scroll-view-school/lessons/8

Hi @jessycatterwaul , @catie , in what instances should we use imageView.bound.size over imageView.frame.size… Not quite getting why you picked frame size on centerImage() and bound size on setZoomParameters() … Is it because scaling/zooming correlates with subview’s local space hence bounds.size, and centering is to subview’s location relative to it’s parent hence frame.size ?

Hi! I think what you’ve said is a good way to think about it. Use the bound properties when when you’re concerned with the contents of the view (scaling or moving the contents within that local space), and use the frame when you’re concerned with the entire view in its parent space.

I’ll make a note to be more clear about this in future updates. There may be a lot of cases where the frame and bound properties will give you exactly the same result, so it’s useful to have a mental model in place to keep your intent clear.

Cool!. will take a note of this one… thanks for the response catie… :slightly_smiling_face:

1 Like