[英]autorotate the Ipad only not iphone
I am working on an app, where app is required to auto-rotate in Ipad only(ie Landscape and the Potrait mode), which am able to achieve. 我正在开发一个应用程序,该应用程序只需要能够在Ipad中自动旋转(即,风景和Potrait模式)即可实现。 But the Iphone one is not required to rotate(ie potarit mode only).
但是不需要Iphone旋转(即仅potarit模式)。 I tried almost every code available on stackoverflow.
我尝试了stackoverflow上几乎所有可用的代码。 but no success.
但没有成功。 I tried following
我尝试了以下
(NSUInteger)supportedInterfaceOrientations
and 和
(BOOL)shouldAutorotate
but no success. 但没有成功。 I am also using NVSlider(a third party) for the slide bar.
我还使用NVSlider(第三方)作为滑动条。 I wrote the code in that file also, as it was too having some orientation related methods, but no result
我也在该文件中编写了代码,因为它也有一些与方向相关的方法,但是没有结果
Well I got the answer. 好吧,我得到了答案。 as I was building a Universal app, I was provided with some option.
在构建通用应用程序时,向我提供了一些选择。 See the images and we can set orientation for IPad and Iphone seprately.
看到图像,我们可以分别设置IPad和Iphone的方向。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
return interfaceOrientation == UIInterfaceOrientationPortrait;
}
return YES;}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.