Khant Thu Linn
Khant Thu Linn

Reputation: 6143

UIImageview/UIVIew in UIWindow cannot rotate to landscape

In my AppDelegate, I have an uiwindow like this. Inside that, there are uiimageview as background.

enter image description here

Problems is that those Imageview aren't rotated when iPad is rotated and status bar is also in landscape position already. May I know how to do?

Edited: If I listen to orientation change, my image view is rotated but I want to set that image view to the origin (0,0) of device. However, it look like uiwindow is offset in horizontal position. Now, I am setting origin of image view as origin of uiwindow. Then, my image view is also offset. How shall I do?

enter image description here

enter image description here

Upvotes: 0

Views: 347

Answers (1)

Andrea
Andrea

Reputation: 26383

That's the correct behavior. UIWindow objects doesn't support rotations.
To do that, you should rotate them by yourself listening to UIDeviceOrientationDidChangeNotification notification.
Managing rotation in a window is a little bit tricky, also because during rotation animation you should be able to detect the rotation direction to make a good user experience.
In my opinion is better if you embed you image views in a view of a view controllers.

Upvotes: 1

Related Questions