简体   繁体   中英

ObjC - Automatic View Rotation

My fellow students and me coded a objective-c program for iPhone. But we have a big problem:

Our App is coded in Portrait-mode, but 2 or 3 Views should be displayed in Landscape-mode (directly). We activated Landscape autorotation in these views, but, if we open one of these views now, we get Portrait again and it only turns into Landscape, when we turn the device.

(Already on our test-device, no problem of the IOS-simulator!)

Can anybody help us please?

The only thing that worked for me was using

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

in my ViewController and presenting it with presentModalViewController . This forces the View to stay in landscape.

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