Created
April 16, 2015 21:13
-
-
Save mkeremkeskin/0ed9fc4a2c0e4942e451 to your computer and use it in GitHub Desktop.
iOS 8.3 UIAlertController orientation bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface UIAlertController (Orientation) | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "UIAlertController+Orientation.h" | |
@implementation UIAlertController(Orientation) | |
#pragma mark self rotate | |
- (BOOL)shouldAutorotate { | |
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; | |
if ( orientation == UIDeviceOrientationPortrait | |
| orientation == UIDeviceOrientationPortraitUpsideDown) { | |
return YES; | |
} | |
return NO; | |
} | |
- (NSUInteger)supportedInterfaceOrientations { | |
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown); | |
} | |
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation | |
{ | |
UIDevice* device = [UIDevice currentDevice]; | |
if (device.orientation == UIInterfaceOrientationPortraitUpsideDown) { | |
return UIInterfaceOrientationPortraitUpsideDown; | |
} | |
return UIInterfaceOrientationPortrait; | |
} | |
@end |
just import UIAlertController+Orientation.h
to the class where you are using UIAlertController
.
Its possible change the Portrait to landscape in UIAlertviewController. i Had used third party library ,there one uialerview showing portrait but our app show in landscape i want change portrait to landscape uialertview.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can you help me how can i use this after including this files in my project what i have to do, thanks in advance, and sorry i am also a new in iOS