Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When an iOS device rotates, how do I change the orientation only one element?

Tags:

iphone

ios5

I would like to be able to handle orientation changes in my current iPhone application. The problem is that I don't want the view of my controller to rotate or resize. When the device orientation changes, I just want one UI element to rotate 90 degrees on the screen.

Apple's camera application is a perfect example of this - when the device orientation changes, all of the buttons rotate, but the view itself does not rotate.

I suppose that I could just resize the view, move all of my elements around, and then animate the buttons, but I feel like there must be an easier way to do it.

Thanks in advance.

like image 218
tnbeatty Avatar asked Jun 04 '12 13:06

tnbeatty


People also ask

Why does my iPhone screen rotate one way?

Swipe down from the top-right corner of your screen to open Control Center. Tap the Portrait Orientation Lock button to make sure that it's off. Turn your iPhone sideways.


1 Answers

1) You can create 2 view hierarchies and change which is on screen in willRotateToInterfaceOrientation: see this question

2) Or you can handle all rotations yourself see this question

like image 63
Jiri Avatar answered Oct 05 '22 22:10

Jiri