简体   繁体   中英

Presenting UIActivityViewController upside down

In simulator and on the iPhone, in iOS 6 and iOS 7, I've noticed that UIActivityViewController doesn't rotate upside down. It doesn't matter if I present it from a general viewController or from the root.

This behavior messes up my interface...

Untill now, my best try it is to prevent UIActivityViewController from being presented when the device is upside down and to block rotation when UIActivityViewController is presented. Anyway, I can't find any reference to this issue.

Is this behavior expected? Do you know any better approach to avoid this behavior, or a better way to prevent my interface from corruption?

It is possible to make all rotations of UIActivityViewController, because it is a subclass of UIViewController, that has rotation methods.

1) In Your UIActivityViewController.m file add method:

- (BOOL)shouldAutorotate
{
    return YES;
}

AND

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
} 

2) in Your info.plist check if Your application supports orientation, You want.

In iOS 6 and later, your app supports the interface orientations defined in your app's Info.plist file. A view controller can override the supportedInterfaceOrientations method to limit the list of supported orientations. Typically, the system calls this method only on the root view controller of the window or a view controller presented to fill the entire screen; child view controllers use the portion of the window provided for them by their parent view controller and no longer participate directly in decisions about what rotations are supported.

The intersection of the app's orientation mask and the view controller's orientation mask is used to determine which orientations a view controller can be rotated into.**

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