Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extension UIAlertController {
- public override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
- return UIInterfaceOrientationMask.Portrait
- }
- public override func shouldAutorotate() -> Bool {
- return false
- }
- }
- extension UIAlertController {
- open override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
- return UIInterfaceOrientationMask.portrait
- }
- open override var shouldAutorotate: Bool {
- return false
- }
- }
- //
- // UIAlertController+supportedInterfaceOrientations.h
- #import <UIKit/UIKit.h>
- @interface UIAlertController (supportedInterfaceOrientations)
- @end
- //
- // UIAlertController+supportedInterfaceOrientations.m
- #import "UIAlertController+supportedInterfaceOrientations.h"
- @implementation UIAlertController (supportedInterfaceOrientations)
- #if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
- - (NSUInteger)supportedInterfaceOrientations {
- return UIInterfaceOrientationMaskPortrait;
- }
- #else
- - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
- return UIInterfaceOrientationMaskPortrait;
- }
- #endif
- @end
- extension UIAlertController {
- public override func shouldAutorotate() -> Bool {
- return true
- }
- public override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
- return UIInterfaceOrientationMask.All
- }
- }
- class MyUIAlertController : UIAlertController {
- override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
- return [UIInterfaceOrientationMask.Portrait,UIInterfaceOrientationMask.PortraitUpsideDown]
- }
- override func shouldAutorotate() -> Bool {
- return false
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement