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 sho开发者_如何学JAVAuld 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.
精彩评论