Activating tilt

Discussion in 'iOS Programming' started by aarontcan, Jun 20, 2011.

  1. aarontcan macrumors newbie

    Joined:
    Jun 16, 2011
    #1
    How do you activate the tilt function in Xcode 4? In other words, how do you allow it to switch its orientation from portrait to landscape when you tilt the device/simulator? The attributes tab in Interface Builder does not allow me to alter it from "portrait", and when I open the simulator and tilt the device to the left or right it stays locked in the portrait view.
     
  2. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    When u click on your Target after you clicked on your project on the upper left.
    U can tell him what Orientations to Support. next up is to change the

    Code:
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
        // Return YES for supported orientations
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    This returns only Portrait mode.
    if you just return YES. It should flip all the time when u switch.

    (in every viewController u need.)
     

Share This Page