views:

26

answers:

1

Hi,

I have a UIView, which contains a UIImageView subview. The subview fills the parent view frame. I am zooming the parent UIView from a point in the center of the screen, from a width and height of 0, 0 up to full size. The subview won't stretch to fill the parent. It just remains full size the whole way through.

I've tried various combinations of contentMode and contentStretch, but nothing I do seems to work.

Help gratefully received.

+1  A: 

If by zooming you mean animating the superviews frame, you have to set up autoresizing correctly. The superview must be set to do autoresizing:

superview.autoresizeSubviews = YES;

... while the image view must have its mask set up correctly:

imageview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
Nikolai Ruhe
Thanks. I've just tried that. The subview behaves strangely. It now becomes huge and massively oversized, but the parent view still behaves perfectly as it did before.
ringbearer