{"id":5212,"date":"2014-03-30T19:43:50","date_gmt":"2014-03-30T19:43:50","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/problem-about-uiinterfaceorientation-collection-of-common-programming-errors\/"},"modified":"2014-03-30T19:43:50","modified_gmt":"2014-03-30T19:43:50","slug":"problem-about-uiinterfaceorientation-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/problem-about-uiinterfaceorientation-collection-of-common-programming-errors\/","title":{"rendered":"problem about uiinterfaceorientation-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/dc2525585a123ab0169554cae01e47b5?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDave<br \/>\nipad uiviewcontroller ipad-splitview uiinterfaceorientation<br \/>\nI am presenting MFMailComposeViewController as modal from a view controller (lets call it xyz) added to nav stack. When user clicks on cancel button, the MFMailComposeViewController is dismissed. This works fine when xyz is added to nav stack in portrait\/landscape mode and the device orientation doesn&#8217;t change until after cancel is clicked. present modal &#8211; alloc init MFMailComposeViewController on a button tap[self.navigationController presentModalViewController:mailController animated:NO];dismi<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1f9f4ac8d09e3c0aed2a7ae65ebbee5f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nNSUserDefault<br \/>\niphone uinavigationcontroller ios6 uiinterfaceorientation<br \/>\nI created an app in ios 6 with navigation view.Also I have set all orientation options in the application summary and even used the-(BOOL) shouldAutoRotateand -(NSUInteger) supportedInterfaceOrientaionmethods in my view controller.when I run my app orientation works fine except upside-down.What should I do to also support upside-down.I also facing the same problem when I add UITabBar controller.Please share your ideas.Thank you<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ead64f9339fd0d584a9c2de3fa0f1e40?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nIv\u00e1n Peralta<br \/>\nuitextfield uiinterfaceorientation uikeyboard<br \/>\nWe&#8217;ve a UIViewController for login on our application, the first load works perfectly, but after a logout, when we back to the login page, we detect some unexpected problem for 6.1 version.I configure the events keyboardDidShow and keyboardWillHide based on notifications, because the Keyboard appear out of the screen.If I print the CGRect of the keyboard based on the UIKeyboardFrameEndUserInfoKey, the behavior is very estrange:First field: {{inf, inf}, {0, 0}} Second field: {{160, 487}, {0, 0}}<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/be9e0cf5a34176943ec24dbddb6bade7?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAleksander Azizi<br \/>\niphone objective-c ios6 uiinterfaceorientation<br \/>\nIn iOS 5 we could change the device orientation programmatically like so:[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];But in iOS 6 setOrientation is depreciated, how may i change the device orientation programmatically in IOS 6?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2ce85af91c9e02ed2093d8c4d811968b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJohnny Tee<br \/>\niphone orientation screen-orientation uiinterfaceorientation<br \/>\nMy app is going from a flipside view (only one orientation) to its main view (can have any sort of orientation. When I go from flipside back to main view, the main view&#8217;s orientation is not checked and changed immediately. I need a way to trigger the built in orientation check that happens in willRotateToInterfaceOrientation so that the orientation is correct when the user goes from flipside view to main view. Any help is appreciated.I saw another question about this but didn&#8217;t see a definiti<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f7be897646a429d9aeb6b979ffa00a3a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPask<br \/>\niphone uiviewcontroller uinavigationcontroller uitabbarcontroller uiinterfaceorientation<br \/>\nI have a UITabBarController that supports four different views, all UINavigationController. To enable the orientation, all views in tabs active at that moment must support it. The problem is that I only enabled the orientation to some views in the grafts UINavigationController. For example:UITabBarController: UINavigationController1: View1 -&gt; View2 -&gt; View3 -&gt; View4 UINavigationController2: View1 -&gt; View2 -&gt; View3 -&gt; View4 UINavigationController3: View1 -&gt; View2 -&gt; View3 -&gt; View4 UINavigationCon<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0c52bebca619255ba06899a68a2ceb23?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nHalle<br \/>\nobjective-c ipad uisplitviewcontroller uiinterfaceorientation tabbarcontroller<br \/>\nI am writing my first tabbar iPad application to which split view controller is added. Everything is working fine but the problem is I am trying to display the root view controller and detail view controller whenever the view gets loaded in portrait mode. To be very clear, I need two controllers to appear the same way as they would appear in landscape mode. Please let me know guys, if there is a way to do it or any other thoughts you have so that it will be helpful for me.I look at MGSplitViewCo<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/Dx2F9.jpg?s=32&amp;g=1\" \/><br \/>\nVinayak Kini<br \/>\nios objective-c ipad ios6 uiinterfaceorientation<br \/>\nI check the orientation of the device in viewDidAppear and viewWillAppear and force the orientation by calling willAnimateRotationToInterfaceOrientation method. &#8211; (void) viewWillAppear:(BOOL)animated{[super viewWillAppear:YES];_levelComplete = YES;[self willAnimateRotationToInterfaceOrientation:[[UIDevice currentDevice] orientation] duration:0.01];}- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{if (toInterfaceO<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/67aafb7a13bd2db706546b49433bec1b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJackson<br \/>\ncocoa-touch ios orientation uiinterfaceorientation viewdidappear<br \/>\nI just tracked down a crash I was having in my iOS app and it is related to willAnimateRotationToInterfaceOrientation being called before viewWillAppear.I have an app with two views. Basically, when view1 disappears, I release some arrays, assuming they will be re-initialized when it re-appears in viewWillAppear.However, if I change orientation in view2 then switch back to view1, this causes willAnimateRotationToInterfaceOrientation to happen before view1 has calledviewWillAppear and re-initiali<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/fe1326d2cf20662c43289572bb1b3d4d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nwael<br \/>\niphone uiimage landscape uiinterfaceorientation page-curl<br \/>\nPlease help me find an answer since i searched everywhere in here and many other websites. Am using this code to make the pageCurl effect. \/\/ Start Animation BlockCGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:nil context:context]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlUpforView:[self view] cache:YES]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:1.0];\/\/ Start Animation BlockCGContextRef context = UI<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/63740dab0b46a521f7faa81981673f5b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nCAMOBAP<br \/>\nios uinavigationcontroller uiinterfaceorientation<br \/>\nI am using UIImagePickerviewController to open the photo library through the below attached code&#8230; after called bit lines of code. The application was crashed&#8230; Its working fine in ios5UIImagePickerController* content = [[UIImagePickerController alloc] init]; content.delegate = self; content.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; [self presentModalViewController:content animated:YES]; [content release];Is anything wrong with this code?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6866d97a94dd87191ac9651e9c9241ca?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nsirab333<br \/>\niphone rotation ios6 uiinterfaceorientation<br \/>\nTHIS IS NOT A DUPLICATE QUESTION. A final working solution has NOT been provided yet so please do not close this question until we&#8217;ve accepted an answer or found and provided our own 100% working solution. Thanks!==================================================================Using Xcode 4.5.1, we have a tab-bar app with 5 tabs in it. Each tab contains a UINavigationController, so the entire App thus needs to be viewed in Portrait mode. There is one exception: an &#8220;image-gallery&#8221; type view con<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1b3d6aa8fa0cc1c4e24e25175d030430?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser2029585<br \/>\nios orientation uiinterfaceorientation autorotate landscape-portrait<br \/>\nMy app is portrait only except one view which contains an embedded YouTube video. That view is supposed to open in landscape and up until recently, worked just fine. The only change I have made to the app is to make it a universal app. I have made no changes to the code for this view though. Any ideas?EDIT: It seems that the view initially loads ok in landscape if you are still holding the device in portrait. It doesn&#8217;t crash until you actually rotate the device or, if you keep holding the d<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/304d82cec4c0b2b99d4aab7eeead713f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nEl Duderino<br \/>\norientation ios6 uiinterfaceorientation<br \/>\njust had to update an iOS 5 App to iOS 6 and of course stumbled over the interface orientation issues. I now already know that things changed and I even know what changed, still I can&#8217;t seem to manage it on my own.My App consists of several viewcontrollers, which get pushed onto a navigationcontroller. All viewcontrollers are supposed to be in landscape orientation, except for one, which should be in portrait orientation. In iOS 5 everything worked fine, but now the one controller in portrait mo<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/iJiQ6.png?s=32&amp;g=1\" \/><br \/>\npratik bhiyani<br \/>\niphone objective-c cocoa-touch landscape uiinterfaceorientation<br \/>\nthis issue is supposed to be a simple one&#8230; i have googled a lot about it and i have tried all the setups on my project. the thing is i am working on a project that is not mine. the app launched from the app delegate and then i am adding aUIViewController (without XIB file) everything done by code. the ViewController is actually on landscape, but the thing is the the app is running on portrait (when i am pulling the notification view it turns dow like in the portrait mode).this is implemented<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8fcf279def5c1abd4cdf30b974dd8787?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDavid<br \/>\niphone ios objective-c game-center uiinterfaceorientation<br \/>\nI have checked other solutions to this problem and none have worked for me. If I try to authenticate a GKLocalPlayer on my physical iPhone (not the simulator; this works in the simulator), I get the following error:Terminating app due to uncaught exception &#8216;UIApplicationInvalidInterfaceOrientation&#8217;, reason: &#8216;Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES&#8217;*** First throw call stack: (0x373463e7 0x33d7e963 0x37346307 0x3815b857 0x382ff<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/474547d103462708c053da7b49df6b6c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nHosemeyer<br \/>\nobjective-c uiimagepickercontroller uiinterfaceorientation<br \/>\nEver since updating my device to 6.1, I&#8217;m getting a crash when trying to show the UIImagePickerController. I only use Portrait orientation.The Crash:Reason: * Terminating app due to uncaught exception &#8216;UIApplicationInvalidInterfaceOrientation&#8217;, reason: &#8216;preferredInterfaceOrientationForPresentation must return a supported interface orientation!&#8217;Here is where I call the UIImagePickerController:if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {\/\/The devi<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/800b206c6dc34c91dc47bfc6bad38bb4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nkevin.ng<br \/>\nobjective-c uiviewcontroller uiinterfaceorientation uiapplication<br \/>\nI managed to push an ABNewPersonViewController to my navigation controller. However I encountered this error when I&#8217;m selecting &#8220;Add photo&#8221; -&gt; &#8220;Choose Photo&#8221;:* Terminating app due to uncaught exception &#8216;UIApplicationInvalidInterfaceOrientation&#8217;, reason: &#8216;Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES&#8217;This error is caused to due the fact that I want my iPad application to have landscape-only orientation.Any idea how to solve this probl<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/81d2c0d1e169fccb63893706ef70db19?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nrmaddy<br \/>\nios objective-c ipad uiinterfaceorientation<br \/>\nIn the RootViewController of my application the orientation code is as below:- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {if(self.activeNavigationController){\/\/NSLog(@&#8221;querying active navigation stack (topViewController = %@) for rotation support &#8230;&#8221;, self.activeNavigationController.topViewController);return [self.activeNavigationController.topViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation];}else{return YES;} }Now I hav<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6d37e62aa04f9208c20bd2742c792798?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nWolvorin<br \/>\nios6 uiimagepickercontroller landscape uiinterfaceorientation<br \/>\nI am developing an app which supports Landscape orientation only. It uses an UIImagePickerController to pick images and\/or videos from the library. App is functioning fine in iOS-5 or before but it gets crashed when I try to present image picker controller.It gives the following message after crashing:* Terminating app due to uncaught exception &#8216;UIApplicationInvalidInterfaceOrientation&#8217;, reason: &#8216;Supported orientations has no common orientation with the application, and shouldAutorotate is retur<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c26861d9114b27960fa236d8dfb2d8ca?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMinna zacharias<br \/>\niphone game-center uiinterfaceorientation ios6<br \/>\nWhen Game center is loaded its default orientation is portrait. In order to lock it in landscape mode, added a category.@implementation GKMatchmakerViewController (LandscapeOnly)- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return ( interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight); }-(NSUInteger)supportedInterfaceOrientations {return UIInterfaceOrientationMaskLandscape; }-<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e7ba07459a66194cd6b8db265efb4dae?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMaulik<br \/>\niphone ios xcode uiinterfaceorientation<br \/>\nMy application is Landscape based. The app crashes immediately when the app runs on my device. I have selected these two fieldsUIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRightI am getting this error:Terminating app due to uncaught exceptionUIApplicationInvalidInterfaceOrientation, reason: Supportedorientations has no common orientation with the application, andshouldAutorotate is returning YES<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2b3d1c2215574e0f09b7ce9dd67184db?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPurva<br \/>\niphone uiwebview xcode4.2 uiinterfaceorientation<br \/>\nI am using the web view to display the HTML contents and using some methods for orientation but as i change the orientation form landscape to portrait for the first time the text goes out from the view.And when i scroll from portrait to another page it shows me the perfectly.May be this happens because of the width from landscape to portrait.The code and method i use is below:Setting the page size- (void)setPageSize:(NSString *)orientation { NSLog(@&#8221;. Set size for orientation: %@&#8221;, orientation);<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/11c3c0be1bc5e43b640b5daa3f215ab6?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nGeri<br \/>\nios uiviewcontroller uinavigationcontroller uiinterfaceorientation autorotate<br \/>\nWhat else should I do?-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) toInterfaceOrientation {return (toInterfaceOrientation == UIInterfaceOrientationPortrait); }- (NSUInteger)supportedInterfaceOrientations {return UIInterfaceOrientationMaskPortrait; }-(BOOL)shouldAutoRotate {return NO; }My viewController still rotates.It is embedded in a navigation stack. If I subclass UINavigationController, and implement the same portrait-only templates there, and I embed my viewControl<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/15e575f58c43bdc11856fae3dab324af?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nlambruscoAcido<br \/>\niphone uinavigationcontroller uitabbarcontroller rotation uiinterfaceorientation<br \/>\nI wanna show a full-screen Landscape view whenever the user rotates the iOS device from portrait to landscape, where the portrait view is a view within a TabBar and NavigationController. However, willRotateToInterfaceOrientation:duration: is never called. I tested also to add the ViewController as Observer of UIDeviceOrientationDidChangeNotification events, but this notification is called also with undefined orientation.What would be the best and easiest way for the given task?<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dave ipad uiviewcontroller ipad-splitview uiinterfaceorientation I am presenting MFMailComposeViewController as modal from a view controller (lets call it xyz) added to nav stack. When user clicks on cancel button, the MFMailComposeViewController is dismissed. This works fine when xyz is added to nav stack in portrait\/landscape mode and the device orientation doesn&#8217;t change until after cancel [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5212","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5212"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5212\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}