3

I've seen it on a previous app (forgetting the app name), where you could lock the current orientation of the screen.

Is there an easy way for this to be done, for example, simply using a button.

Domness
  • 7,585
  • 8
  • 40
  • 50

1 Answers1

5

Just add an ivar to your app delegate that can be set by pressing the locking button. Then in all of your view controllers you can just check the ivar in the app delegate and respond to the

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

message according to your orientation ivar

nduplessis
  • 12,236
  • 2
  • 36
  • 53
  • this will block the app, if is used as rootViewController, but if you need only 1 screen and others not, this answer isn't good, check here: http://stackoverflow.com/questions/12286998/uiviewcontroller-do-not-rotate-to-landscape –  Sep 08 '12 at 13:30