简体   繁体   中英

iPhone iOS8: UIAlertView upside down rotation doesn't work fine when build from iOS7.1 sdk and run on 8.0 and above devices

Any one has any idea how to fix this for iOS 8 device. is it Apple's implementation issue for UIAlertview ?

I am having screen shot for the same. But can not upload due to reputation limit :(

In IOS8 added UIAlertController instead of UIAlertView

if (([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] == NSOrderedAscending)) {
    // use UIAlertView
}
else {
    // use UIAlertController

[self  showAlert];
}



-(void)showAlert

{
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"AlertView" message:nil preferredStyle:UIAlertControllerStyleActionSheet;
    UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"GO" style:UIAlertActionStyleDefault
    handler:^(UIAlertAction * action) {
    // [action doSomething];

    }];

    UIAlertAction* cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault
    handler:^(UIAlertAction * action) {
    [alert dismissViewControllerAnimated:YES completion:nil];

    }];

    [alert addAction:defaultAction];
    [alert addAction:cancel];
    [self presentViewController:alert animated:YES completion:nil];

    } 

Try with that solution.

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