Floating Rotation Control?

Discussion in 'iOS Programming' started by ArtOfWarfare, Feb 9, 2013.

  1. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #1
    Hi,

    I'd like to have an on screen way for the user of my app to swap between locked portrait, locked landscape, and unlocked autorotate.

    First off, is there any good existing code I can just throw in for this?

    If not, here's what I have in mind:
    A 3 segmented control that fades in at the top left corner when a rotation event occurs. If the user doesn't interact with it, it'll fade right out after a few seconds. But if the user does interact with it, it should force the interface to rotate whichever way the user says it should. Except I don't want the control to. The rest of the app, the keyboard, and the status bar should all rotate, but the control shouldn't (so accidental touches are quick to undo.) I think this might be accomplishable by placing it in a seperate UIWindow. Will this work? Is it a good idea?
     
  2. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #2

    What you describe MIGHT be possible, but more likely not. You are altering the flow of autorotation that Apple designed, and introducing a number of twists.

    When the device detects a rotation, it asks your current view controller which orientations it should supports, and then triggers a rotation if the current orientation is one of them. By the time you could show a segmented control, that interaction would be over, and the UI will have either rotated or not. I don't know of a way to then introduce a UI rotation after the fact.

    If you're determined to implement this UI, you might need to turn off all system-based UI rotation and implement your own that manipulates your view hierarchy yourself and simulates UI rotation.

    Beware that if you get all this working, you run the risk that Apple might reject your app as not following their HIG (Human Interface Guidelines.) They don't like it when you make significant changes to their UI conventions.
     

Share This Page