I was doing a Split View-Based Appliaction, which requires the code to determine the current screen orientation, and position adjustment controls, the following code in a single view project tried to be able to play a role:
- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation {
return YES;
}
- (Void) positionViews {
UIInterfaceOrientation destOrientation = self.interfaceOrientation;
if (destOrientation == UIInterfaceOrientationPortrait | |
destOrientation == UIInterfaceOrientationPortraitUpsideDown) {
/ / --- If rotating to portrait mode ---
NSLog (@ "Portrait");
} Else {
/ / --- If rotating to landscape mode -
NSLog (@ "LandScape");
}
}
- (Void) willAnimateSecondHalfOfRotationFromInterfaceOrientation:
(UIInterfaceOrientation) fromInterfaceOrientation
duration: (NSTimeInterval) duration {
NSLog (@ "here");
[Self positionViews];
}
But in the Split View-Based project, when I put the above code to join DetailViewController.m or RootViewController.m them, run do not nslog output
Ask you, in the Split View-Based project which should be how to determine the direction of rotation of the screen, thank you!
Reply:
No comments:
Post a Comment