繁体   English   中英

自动旋转Ipad,而不是iphone

[英]autorotate the Ipad only not iphone

我正在开发一个应用程序,该应用程序只需要能够在Ipad中自动旋转(即,风景和Potrait模式)即可实现。 但是不需要Iphone旋转(即仅potarit模式)。 我尝试了stackoverflow上几乎所有可用的代码。 但没有成功。 我尝试了以下

(NSUInteger)supportedInterfaceOrientations 

(BOOL)shouldAutorotate

但没有成功。 我还使用NVSlider(第三方)作为滑动条。 我也在该文件中编写了代码,因为它也有一些与方向相关的方法,但是没有结果

好吧,我得到了答案。 在构建通用应用程序时,向我提供了一些选择。 看到图像,我们可以分别设置IPad和Iphone的方向。 仅为iPad选择的选项

仅为iPhone选择的选项

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
    return interfaceOrientation == UIInterfaceOrientationPortrait;
}

return YES;}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM