views:

282

answers:

1

Hi I have this piece of code...

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}

and

- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{

  if(UIInterfaceOrientationIsPortrait(interfaceOrientation)){
    // WTF, this runs when I change to Landscape
  } else {
    // this runs when I change to Portrait??? shouldn't it be the contrary?
  }
}

as you see, the code is running in reverse, I mean, the part the should run when I change the device to portrait, the landscape part of the code runs and vice-versa.

WHen I turn the device, self.view rotates.

is this UIInterfaceOrientationIsPortrait testing how the interface is before the rotation or am I missing something?

thanks for any help.

+4  A: 

Note that the method is named didRotateFromInterfaceOrientation, so naturally the interfaceOrientation parameter contains the old orientation, not the new one.

Ole Begemann
ahhh.... obviously! I never noticed the FROM in the name... haha. THANkS.
Digital Robot