简体   繁体   中英

view does not rotate when orientation is upsidesidedown in ios 7

I tring to make app support all orientation. Its working fine but only upside down orientation is not working. I am using ios7. For upside down the view does not rotate. I tried following code

-(BOOL)shouldAutorotate  
{
return yes;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll; // etc
}

My only second method is called but not first method. In infoPlist I enabled all the supported orientations.

Found the fix. Sourced mainly from: https://stackoverflow.com/a/12758715/394969

In a nutshell for people who land here first:

/* In your view controller */
// Add support for upside down 
-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

Also flip on all device orientations in project settings as outlined in @Jignesh Mayani's answer. If that doesn't immediatley fix your issue check the link above for how to work with nav controllers and tab controllers (they all must support the required interface orientations).

Confirm that you have check, Go your project setting and Check 在此处输入图片说明

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