In my application i have UIIMageView within UIView, in portrait mode imageview fills whole area of UIView, but after orientation is changed UIView rotates but not stretched, though i have set content mode of UIView to Scale to fill, what is wrong?
Asked
Active
Viewed 2,622 times
0
-
screens would helped in this situation... – demon9733 Apr 20 '12 at 10:32
2 Answers
1
Set the autoresizing mask:
yourUIImageViewInstance.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
read also this.

Community
- 1
- 1

Jonas Schnelli
- 9,965
- 3
- 48
- 60
-
thanks it helps me, but in this case i don't understand the meaning of content mode of view, as i know when we set content mode to Stretch to fill the child controls should be stretched to fill whole area right ? – taffarel Apr 20 '12 at 10:55
-
content mode "Stretch" means the UIImage gets stretches into the UIImageView BUT NOT the UIImageView in the superview! For that you need autoresizing. – Jonas Schnelli Apr 20 '12 at 10:59
0
you can try using
imageview.frame=CGMakeRect(x, y, width, height);
in setPositionForOrientation function

Anila
- 1,136
- 2
- 18
- 42