简体   繁体   中英

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. But the Iphone one is not required to rotate(ie potarit mode only). I tried almost every code available on 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. 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;}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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