iPhone - Interface Orientation reversed?
-
21-09-2019 - |
문제
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.
해결책
Note that the method is named didRotateFromInterfaceOrientation, so naturally the interfaceOrientation
parameter contains the old orientation, not the new one.
제휴하지 않습니다 StackOverflow