Apple demonstrated Photo's for the iPad. In their demo, they said you can Flip the iPad and it flips the image.
How is this result achieved?
I've been reading ab开发者_Go百科out UIInterfaceOrientation all day and I'm lost
Any help would be appreciated.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
// NSLog(@"orientation: %@", [orientation )
if(orientation==UIInterfaceOrientationPortrait ||orientation==UIInterfaceOrientationPortraitUpsideDown) {
//Code
return NO;
}
if (orientation==UIInterfaceOrientationLandscapeRight ||orientation==UIInterfaceOrientationLandscapeLeft ) {
//Code
return YES;
}
return NO;
}
You implement in your UIViewController subclass:
- (BOOL)shouldAutorotateToDeviceOrientation:... {
Return YES;
}
And most of the time the UIKit manages it all for you.
精彩评论