Search code examples
iosobjective-crubymotion

Keep RubyMotion application from rotating


How can I stop a RubyMotion application from rotating?

I tried implementing:

def shouldAutorotateToInterfaceOrientation(interfaceOrientation) 
  UIInterfaceOrientationLandscapeRight == interfaceOrientation 
end

but I want something that is application-wide, is there a method I can set in the AppDelegate that will control this throughout the app?


Solution

  • You can find a good solution here:

    iOS 6 apps - how to deal with iPhone 5 screen size?

    If you'd like to make it more application-wide, I'd recommend creating a module you can include.

    module Rotation
      # methods here
    end
    
    class MyViewController < UIViewController
      include Rotation
    end