Change orientation of UIViewController

Change orientation of UIViewController

Is it possible to change the UIViewController orientation dynamically?

View Answers

July 2, 2011 at 12:54 PM

To enable the interface orientation in UIView just add the given code into your interface orientation method..

UIInterfaceOrientation interfaceOrientation = self.interfaceOrientation;



typedef enum {
  UIInterfaceOrientationPortrait           = UIDeviceOrientationPortrait,
  UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
  UIInterfaceOrientationLandscapeLeft      = UIDeviceOrientationLandscapeLeft,
  UIInterfaceOrientationLandscapeRight     = UIDeviceOrientationLandscapeRight
} UIInterfa

July 2, 2011 at 1:04 PM

iPhone Interface Orientation code

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations.
return YES; // Return YES is the same as entering all interfaces.
}


-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {

if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {


    [self presentModalViewController:landscapeChartViewController animated:NO];
}

if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {

    [self.parentViewController dismissModalViewControllerAnimated:NO];
    // self.parentViewController seems like a call FROM the modalViewController. 
    // This should be moved to the modalViewControllers implementation
}
}









Related Tutorials/Questions & Answers:
Change orientation of UIViewController
Change orientation of UIViewController  Is it possible to change the UIViewController orientation dynamically
iphone handle orientation change
iphone handle orientation change   How can i handle the orientation change in iPhone / iPad application? Please suggest. Thank in Advance
Advertisements
uiviewcontroller viewwillappear
uiviewcontroller viewwillappear  When i reload uiviewcontroller, viewwillappear method not getting called. Can anyone please explain what is the proble
Rotating UIViewController
Rotating UIViewController In this example, we are going to show you.. how to rotate your UIView into both portrait or landscape orientation. Steps for Rotating UIViewController in both portrait and landscape orientation.ADS_TO_REPLACE_1
How to dismiss UIViewController
How to dismiss UIViewController  How to dismiss UIViewcontroller in my iPhone application? Please suggest. Thanks
Call UIViewController over RootViewController
Call UIViewController over RootViewController   Hi, i have created the window based application.. but not sure how to call the UIView over RootViewController. Thanks
reload uiviewcontroller iphone
reload uiviewcontroller iphone  Can anyone tell me how to reload the uiviewcontroller in my iphone application every time ..whenever i switch and come back from different view controller. Thanks!   the viewWillAppear
landscape orientation iPad
landscape orientation iPad   In my iPad application, i want to change the orientation as landscape only.. how could i be done? Currently i'm using...; } Please help. Thanks in advance!   To fix the orientation
Orientation iPhone SDK
Orientation iPhone SDK In this tutorial we are going to show you how to set orientation in iPhone application. While developing the application in iPhone please keep in mind that landscape orientation is not possible in the case
color change
color change  how to change the color in circle using scrollbar
change password
change password  how to change password in the login form.... by giving options to user like this old password, new password.. pls help
Change Email
Change Email  Hi, I need to change my Rose India register email address for receive email, How did it possible
ModuleNotFoundError: No module named 'kw-pricing-orientation'
ModuleNotFoundError: No module named 'kw-pricing-orientation'  Hi...: No module named 'kw-pricing-orientation' How to remove the ModuleNotFoundError: No module named 'kw-pricing-orientation' error? Thanks   Hi
ModuleNotFoundError: No module named 'kw-pricing-orientation'
ModuleNotFoundError: No module named 'kw-pricing-orientation'  Hi...: No module named 'kw-pricing-orientation' How to remove the ModuleNotFoundError: No module named 'kw-pricing-orientation' error? Thanks   Hi
ModuleNotFoundError: No module named 'face-orientation-prep-natchapolt'
ModuleNotFoundError: No module named 'face-orientation-prep-natchapolt' ...: ModuleNotFoundError: No module named 'face-orientation-prep-natchapolt' How to remove the ModuleNotFoundError: No module named 'face-orientation-prep-natchapolt'
password change
password change  Hi , I am using jsf and trying to write a code to change the password of a user . Ihave to retrine userid fromdata base how to do that using session
Version of com.gluonhq>charm-down-plugin-orientation dependency
List of Version of com.gluonhq>charm-down-plugin-orientation dependency
uitableview inside uiviewcontroller
How to change background, change background
How to change background       This example will teach you to change background of any object... a picture to change background.ADS_TO_REPLACE_1 Selection: Make selection
change file permission in php
change file permission in php  How to change file permission in PHP
change appearance of alert box
change appearance of alert box  how to change the appearance of an alert() box
change value of mutable string
change value of mutable string  How to change value of mutable string
change content of cell javascript
change content of cell javascript  change content of cell javascript
change xml dynamically
change xml dynamically  How to change an XML dynamically in Java
Version of com.gluonhq>charm-down-plugin-orientation-android dependency
List of Version of com.gluonhq>charm-down-plugin-orientation-android dependency
Version of com.gluonhq>charm-down-plugin-orientation-ios dependency
List of Version of com.gluonhq>charm-down-plugin-orientation-ios dependency
How to change the face, change the face
How to change the face       You have a chance to learn how to change the face of the person to another face. It has very simple technique to make this effect
ModuleNotFoundError: No module named 'change'
ModuleNotFoundError: No module named 'change'  Hi, My Python... 'change' How to remove the ModuleNotFoundError: No module named 'change'... to install padas library. You can install change python with following command
change uislider value
change uislider value  change uislider value   change NSSlider Value programmatically You can use the methods of NSControl. Example: [self.slider setDoubleValue:0.1
php date format change
php date format change  How to change the date format in PHP
dynamic image change javascript
dynamic image change javascript  How to display images in JavaScript dynamically
ModuleNotFoundError: No module named 'Python-video-annotator-module-find-orientation'
-orientation'  Hi, My Python program is throwing following error...-orientation' How to remove the ModuleNotFoundError: No module named 'Python-video-annotator-module-find-orientation' error? Thanks   Hi
To change font in java code
To change font in java code  I am sending system generated mail through MIME message and Transport. Now i need to change the font.. Can you please help me as how to change the font of string body in java code
change value - Ajax
change value  hello buddy.........please help me i have a drop down box, i have to change my text box value acording to that drop down option.........(where all i need to change to use ajax in my application
Change the name of the grades
Change the name of the grades  Hi, i'm developing with polar chart and i want to change the name of the grades, for example: add("variable name",5) insted of add(20, 5). Somebody know how to do it? Tanks
Change Password - JSP-Servlet
Change Password  Hi all, Please kindly help me with jsp code and explanations to enable me write a change password program. This program will connect to mssql database 2000. Thanks
Text change and click events
Text change and click events  Create user login form and apply textchange and click events in java
Excel Column change
Excel Column change  How to change sequence of columns in Excel sheet through Java
Impact on change of table name
Impact on change of table name  What is the impact when we change... which is going to change. Please update me on this.... Regards, Srinivas Alwala   Use the given query to change the table name. RENAME TABLE
Change font in swing?
Change font in swing?  I want to use marathi language on labels,buttons
change kerberos principal password
change kerberos principal password  How to change the password of a pricipal? My principal is abcd/mydomain.com What is the command of it? Thanks... to change password: change_password abcd/mydomain.com It will ask for new
Maven Dependency charm-down-plugin-orientation >> 3.0.0
You should include the dependency code given in this page to add Maven Dependency of com.gluonhq >> charm-down-plugin-orientation version3.0.0 in your project
Maven Dependency charm-down-plugin-orientation >> 3.1.0
You should include the dependency code given in this page to add Maven Dependency of com.gluonhq >> charm-down-plugin-orientation version3.1.0 in your project
Maven Dependency charm-down-plugin-orientation >> 3.2.0
You should include the dependency code given in this page to add Maven Dependency of com.gluonhq >> charm-down-plugin-orientation version3.2.0 in your project
Maven Dependency charm-down-plugin-orientation >> 3.2.1
You should include the dependency code given in this page to add Maven Dependency of com.gluonhq >> charm-down-plugin-orientation version3.2.1 in your project
Maven Dependency charm-down-plugin-orientation >> 3.2.2
You should include the dependency code given in this page to add Maven Dependency of com.gluonhq >> charm-down-plugin-orientation version3.2.2 in your project
Maven Dependency charm-down-plugin-orientation >> 3.2.3
You should include the dependency code given in this page to add Maven Dependency of com.gluonhq >> charm-down-plugin-orientation version3.2.3 in your project
Maven Dependency charm-down-plugin-orientation >> 3.2.4
You should include the dependency code given in this page to add Maven Dependency of com.gluonhq >> charm-down-plugin-orientation version3.2.4 in your project
Maven Dependency charm-down-plugin-orientation >> 3.3.0
You should include the dependency code given in this page to add Maven Dependency of com.gluonhq >> charm-down-plugin-orientation version3.3.0 in your project
change player dress color
change player dress color  Hai friends, Can we change player dress color using J2ME. Please provide me an code for this. I can able to attain three colors only. Send the code to mail id. [email protected]_TO_REPLACE_1

Ads