0

I have a UIView that contains two UIImageViews. when I perform animateWithDuration and change its frame (x, y, width, height) , it's subviews aren't resized according to its frame.

How can this be done? is it something with contentMode of the superview or subviews?

Regexident
  • 29,441
  • 10
  • 93
  • 100
Nimrod Yizhar
  • 381
  • 4
  • 14

1 Answers1

1

You need to configure the subviews auto-resizing rules. If you don't specify any rules the subviews will maintain their size and position (relative to the top left corner).

Check the auto-resizing documentation here. That's the 'simple' version which works from before iOS 6. From iOS 6 onwards you can also use auto-layout which is described here.

Wain
  • 118,658
  • 15
  • 128
  • 151
  • thanks, the documentation link led me to the autoresizemask property, but this question: http://stackoverflow.com/questions/7754851/autoresizing-masks-programmatically-vs-interfact-builder-xib-nib really helped me because it explains how to do it in IB. – Nimrod Yizhar May 26 '13 at 06:40