'支持的方向与应用程序没有共同的方向,并且 shouldAutorotate 返回 YES'

#39;Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES#39;(支持的方向与应用程序没有共同的方向,并且 shouldAutorotate 返回 YES)
本文介绍了'支持的方向与应用程序没有共同的方向,并且 shouldAutorotate 返回 YES'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

*我的视图处于景观模式,我正在保存图像,我想要返回该图像,因为我的代码在下面,我收到错误由于未捕获的异常 'UIApplicationInvalidInterfaceOrientation' 而终止应用程序,原因:'支持的方向与应用程序没有共同的方向,并且 shouldAutorotate 正在返回 YES'" * 我可以为 iphone 做什么?

*My view is in land scape mode i am saving image and i want that image back for that i my code is below and i am geting error "Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'" * what can i do for iphone?

        `- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {

         [self dismissModalViewControllerAnimated:YES];
         [picker release];

              }
             - (void)imagePickerController:(UIImagePickerController *)picker 

                didFinishPickingMediaWithInfo:(NSDictionary *)info {

            [picker dismissModalViewControllerAnimated:NO];

                imageDoodle.image = [info objectForKey:@"UIImagePickerControllerMediaMetadata"];

                 }

               -(IBAction)loadfromalbumclicked:(id)sender

                 {

                UIImagePickerController * picker = [[UIImagePickerController alloc] init];

                picker.delegate = self;

                 picker.allowsEditing=NO;

        picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

               // self.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;

              [self presentModalViewController:picker animated:YES];
               }

              -(IBAction)savePrint{
//Save image to iOS Photo Library

                 UIImageWriteToSavedPhotosAlbum(imageDoodle.image, nil, nil, nil);
//Create message to explain image is saved to Photos app library
                 UIAlertView *savedAlert = [[UIAlertView alloc] initWithTitle:@"Saved"  

                message:@"Your picture has been saved to the photo library, view it in the 

               Photos app." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
//Display message alert
             [savedAlert show];
              }`

推荐答案

尝试将 shouldAutoRotate 设置为 NO 看看是否有效.

try setting shouldAutoRotate to NO and see if it works.

您可以在 iOS 6.0 或更高版本中使用 shouldAutoRotate 和 supportedInterfaceOrientations 方法,而不是(不推荐使用的) shouldAutoRotateToInterfaceOrientation 方法.

You can use shouldAutoRotate and supportedInterfaceOrientations methods in iOS 6.0 or later, instead of the (deprecated) shouldAutoRotateToInterfaceOrientation method.

类似的东西-

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}


- (BOOL) shouldAutorotate {
    return YES;
}


- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationPortrait;
}

这篇关于'支持的方向与应用程序没有共同的方向,并且 shouldAutorotate 返回 YES'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

AWS DynamoDB Batch Get Request - iOS(AWS DynamoDB 批量获取请求 - iOS)
DynamoDB auto incremented ID amp; server time (iOS SDK)(DynamoDB 自动递增 ID amp;服务器时间(iOS SDK))
Facebook Requests Dialog: Frictionless Requests in native iOS app possible?(Facebook 请求对话框:本机 iOS 应用程序中的无摩擦请求可能吗?)
Difference between iPhone Simulator and Android Emulator(iPhone模拟器和Android模拟器之间的区别)
dynamodb scanexpression with scan filter in objective-c(在objective-c中带有扫描过滤器的dynamodb scanexpression)
Getting full access to DynamoDB from my ios app using AWS Cognito Developer Identities(使用 AWS Cognito 开发人员身份从我的 ios 应用程序获得对 DynamoDB 的完全访问权限)