1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

rotation

Discussion in 'iPhone/iPad Programming' started by chhoda, Dec 20, 2008.

  1. macrumors 6502

    #1
    I have a viewcontroller class where I am doing

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    //return (interfaceOrientation == UIInterfaceOrientationPortrait);
    return YES;
    }

    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation // Notification of rotation ending.
    {
    NSLog(@"Orientation: %@", fromInterfaceOrientation);
    }


    but the log is never printed, does rotation work properly in simulator ? or i need to test that on device ?

    ch
     
  2. macrumors regular

    #2
    You should be getting a crash with that code since a UIInterfaceOrientation is actually an integer. If I change the logging code to:

    NSLog(@"Orientation: %d", fromInterfaceOrientation);

    it works fine in the simulator.
     
  3. macrumors 6502

    #3
    i wish

    I wish I got a crash even ! i put a breakpoint in both the functions and try debug, breakpoint is never hit !
     
  4. macrumors newbie

    #4
    Then your viewcontroller isn't being used. Is there a reference to your viewcontroller in the main NIB file, and that's how you expect it to be instantiated? Can you post the rest of your code?
     
  5. macrumors 6502

    #5
    no luck yet !

    Its quite a bit of code to post here. WOuld you mind which portions of the code you wanna have a look ?

    > Is there a reference to your viewcontroller in the main NIB file, and that's how you expect it to be instantiated?

    by the way, how would I verify this, if I am not sure ?

    regards
    CH
     
  6. macrumors 6502

    #6
    simulator settings ?

    is there a simulator setting which blocks/releases these rotation events to viewcontroller ? I am getting this feeling because I see in my simulator, the native aplication like photos, safari, addressbook also do not respond to landscape potrait rotation

    rgds
    ch
     
  7. macrumors regular

    #7
    No, there's not.

    However your viewController may return YES for shouldAutoRotate but if something else further up the view controller stack *doesn't* then your view won't rotate anyway.
     

Share This Page