taffarel
taffarel

Reputation: 4045

Scale UIImageView after orientation changed

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?

Upvotes: 0

Views: 2625

Answers (2)

Anila
Anila

Reputation: 1136

you can try using

 imageview.frame=CGMakeRect(x, y, width, height);

in setPositionForOrientation function

Upvotes: 0

Jonas Schnelli
Jonas Schnelli

Reputation: 10005

Set the autoresizing mask:

yourUIImageViewInstance.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;

read also this.

Upvotes: 1

Related Questions