iPhone / iPad App定位 [英] iPhone/iPad App Orientation

查看:114
本文介绍了iPhone / iPad App定位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序的iPhone版本支持 UIDeviceOrientationPortraitUpsideDown UIDeviceOrientationPortrait ,但iPad版本支持所有方向。

The iPhone version of my app supports UIDeviceOrientationPortraitUpsideDown and UIDeviceOrientationPortrait, but the iPad version supports all Orientations.

在我的视图控制器中我有这个:

In my view controller I have this:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation     {
    return YES;
}

我的Info.plist文件包含:

and my Info.plist file has this:

问题在于,当我将应用程序构建到iPod时,应用程序不会颠倒过来。 iPad将支持所有方向。

The problem is that when I build the app to my iPod, the app won't turn upside down. The iPad will support all Orientations.

我已经尝试一起删除 shouldAutorotateToInterfaceOrientation ,我试过这个代码:

I've tried removing the shouldAutorotateToInterfaceOrientation all together and I've tried this code:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation = UIDeviceOrientationLandscapeLeft) && (interfaceOrientation = UIDeviceOrientationLandscapeRight) && (interfaceOrientation = UIDeviceOrientationPortraitUpsideDown) && (interfaceOrientation = UIDeviceOrientationPortrait);
}

但由于某种原因,颠倒只是行不通!还有其他解决方案吗?

But for some reason, the upside down just won't work! Are there any other solutions for this?

编辑:使用Xcode 4.5 iOS6

推荐答案

想出来,iOS6 SDK使用 shouldAutorotate 所以这是我的新代码:

Figured it out, the iOS6 SDK uses shouldAutorotate so here is my new code:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}

-(BOOL)shouldAutorotate {
     return YES;
}

-(NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}

这篇关于iPhone / iPad App定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆