title: How can I make a custom orientation lock action?
body: <p>I would like to make a custom orientation lock button for a reader app of mine, and I was thinking it wouldn't be too bad to whip up, but alas I am the one getting whipped.</p>
  
  <p>To start off I do have this method:</p>
  
  <pre><code>- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  return YES;
   }
  </code></pre>
  
  <p>And then I was thinking that I could handle the actual locking in an action method like this:</p>
  
  <pre><code>- (IBAction) screenLock:(id)sender{
  
  if([UIDevice currentDevice].orientation == UIDeviceOrientationPortrait){
  
      [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait];
  
  }else{
  
              [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
  
  }
  
    }
  </code></pre>
  
  <p>But alas, this code will not hold sway over the former that instructs the view to rotate...</p>
  
  <p>Am I going about this all wrong? What is a better way to do it? I just want to have local, easy way to have my users lock the orientation of their screen. I guess it would be using a boolean value where they hit a button to lock and then hit again to unlock...</p>
  
  <p>Thoughts?
  Thanks!!</p>