Objective c 横向模式:翻转iPad时翻转图像

Objective c 横向模式:翻转iPad时翻转图像,objective-c,iphone,cocoa-touch,uikit,ipad,Objective C,Iphone,Cocoa Touch,Uikit,Ipad,苹果展示了iPad的照片。在他们的演示中,他们说你可以翻转iPad,它可以翻转图像 这一结果是如何实现的 我整天都在读关于UIInterfaceOrientation的书,我迷路了 任何帮助都将不胜感激 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { UIInterfaceOrientation orientation = [[UIDevice curren

苹果展示了iPad的照片。在他们的演示中,他们说你可以翻转iPad,它可以翻转图像

这一结果是如何实现的

我整天都在读关于UIInterfaceOrientation的书,我迷路了

任何帮助都将不胜感激

- (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;
}

在UIViewController子类中实现:

- (BOOL)shouldAutorotateToDeviceOrientation:... {
    Return YES;
}

大多数情况下,UIKit都是为您管理的。

谢谢,但您如何知道它何时翻转BOOLshouldAutorotateToInterfaceOrientation:UIInterfaceOrientation接口方向{UIInterfaceOrientation方向=[[UIDevice currentDevice]方向];//NSLog@orientation:%@[orientation iforientation==UIInterfaceOrientationGraphital | | orientation==UIInterfaceOrientationGraphitalUpsideDown{//代码返回号;}如果方向==UIInterfaceOrientationAndscapeRight | |方向==UIInterfaceOrientationAndscapeLeft{//代码返回YES;}返回NO;}我对它进行了测试,它似乎没有进行任何翻转。我甚至不确定何时翻转。大多数时候,你不在乎视图是否翻转,设备会为你处理旋转。如果你的控制器在选项卡/中堂控制器中,你需要确保所有视图控制器都通过此方法返回真值。Paul。如果你有iPad,请下载Billboardz:ROAD RAGE你会选择一个标志,然后翻转它,这样屏幕就不会面向你了。文字是颠倒的,这样你就可以在镜子中看到它们。我想为我的应用程序执行类似的操作。这是可能的,但如果你有一些示例代码来演示,我会非常感激!啊哈!这是一个完全不同的翻转,不是真正相关的为设备定向。