Tuesday, September 4, 2012

iOS Auto resizing subviews

I have the parent view: self.view and a subview: UIImageView *pinView.

I would like pinView resize when self.view becomes resized.  To accomplish this:

[pinView setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight];


Early attempts that did NOT work:
[self.view setAutoresizesSubviews:YES];
[self.view setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight];

You will need to apply the autoresize mask to the subview you want resized.

No comments:

Post a Comment