iphone handle orientation change

iphone handle orientation change

How can i handle the orientation change in iPhone / iPad application? Please suggest.

Thank in Advance!

View Answers

December 10, 2010 at 12:10 PM

Given is the method to manage or change the orientation in iPad application

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown || interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
    }


    // orientation view swapping logic
    - (void)didRotate:(NSNotification *)notification {

    UIDeviceOrientation newOrientation = [[UIDevice currentDevice] orientation];
    if (newOrientation != UIDeviceOrientationUnknown || newOrientation != UIDeviceOrientationFaceUp || newOrientation != UIDeviceOrientationFaceDown) 
    {
           orientation = newOrientation;

    }

    // Write your orientation logic here
        if ((orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight)) 
    {
     // Clear the current view and insert the orientation specific view.
         [self clearCurrentView];
         [self.view insertSubview:yourLandscapeView atIndex:0];

    } else if (orientation == UIDeviceOrientationPortrait || orientation == UIDeviceOrientationPortraitUpsideDown) 
    {
           // Clear the current view and insert the orientation specific view.
            [self clearCurrentView];
            [self.view insertSubview:yourPortraitView atIndex:0];

        }
    }

December 10, 2010 at 12:10 PM

Given is the method to manage or change the orientation in iPad application

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown || interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
    }


    // orientation view swapping logic
    - (void)didRotate:(NSNotification *)notification {

    UIDeviceOrientation newOrientation = [[UIDevice currentDevice] orientation];
    if (newOrientation != UIDeviceOrientationUnknown || newOrientation != UIDeviceOrientationFaceUp || newOrientation != UIDeviceOrientationFaceDown) 
    {
           orientation = newOrientation;

    }

    // Write your orientation logic here
        if ((orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight)) 
    {
     // Clear the current view and insert the orientation specific view.
         [self clearCurrentView];
         [self.view insertSubview:yourLandscapeView atIndex:0];

    } else if (orientation == UIDeviceOrientationPortrait || orientation == UIDeviceOrientationPortraitUpsideDown) 
    {
           // Clear the current view and insert the orientation specific view.
            [self clearCurrentView];
            [self.view insertSubview:yourPortraitView atIndex:0];

        }
    }

Ads









Related Tutorials/Questions & Answers:
iphone handle orientation change
iphone handle orientation change   How can i handle the orientation change in iPhone / iPad application? Please suggest. Thank in Advance
Change orientation of UIViewController
Change orientation of UIViewController  Is it possible to change the UIViewController orientation dynamically
Advertisements
Looking for change password in iphone application sdk using sqlite
Looking for change password in iphone application sdk using sqlite  i am trying to change old password in my iphone application my code is below please help how can i do .... -(IBAction)matchpassword{ //sqlite3_stmt
iphone
iphone  How can connect with the other database in iphone application(like... MYsql or oracle) is this dirctly possible
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
Sitemap iPhone Tutorial
iPhone | Objective C Tutorial | Objective C Introduction | Why... C on Mac | Compiling Objective C | iPhone Application Development...: retain and release | Objective-c Dealloc | Objective C | iPhone
ModuleNotFoundError: No module named 'handle'
ModuleNotFoundError: No module named 'handle'  Hi, My Python... 'handle' How to remove the ModuleNotFoundError: No module named 'handle'... to install padas library. You can install handle python with following command
iPhone Graphics
iPhone Graphics  Hi, How to create iPhone Graphics? I am learning to crate UI Design for iPhone and iPad. Thanks
iphone avfoundation
iphone avfoundation  What is iphone avfoundation and why it is required? Can anyone show how to implement the AVFoundation in iPhone application with example or tutorial? Thanks
Iphone call
Iphone call  Do you have other method to make a call on Iphone,without openUrl
java exception handle
java exception handle  How error can be handled in the exception class?? can we handle fatal error in java
Iphone Tutorial
Iphone Tutorial  Hi, I am a new in this mobile applications segment. From where i will get the information about iphone tutorial or Iphone Development Tutorials. Please suggest the resouces......... Thanks
PayPal integration in iPhone native app
PayPal integration in iPhone native app  I am looking for some help in integrating the paypal in iPhone application. Please help. Thanks.  ... the UIWebView. and let the web handle
how to handle MySQLIntegrityConstraintViolationException?
how to handle MySQLIntegrityConstraintViolationException?  Cannot add or update a child row: a foreign key constraint fails (outerdb.outerpatient, CONSTRAINT outerpatient_ibfk_1 FOREIGN KEY (xrayno) REFERENCES xray (xrayno
iPhone apps developer
parity with the iPhone and are easy to handle. We create magnificent iPhone...iPhone apps developer With the launch of Apple's innovative product iPhone.... After getting authority to develop applications for iPhone or iPhone apps
iPhone
iPhone       Apple iPhone 3G is a multi-touch smartphone that has successfully combined multimedia, email, business and internet into a single platform. The iPhone
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
iPhone and iPad universal app
iPhone and iPad universal app  I am writing a universal application in iPhone and iPad that is not working in iPhone simulator. Though i have tested.... find the list of framework at the bottom of the tab and change the type
NSZombieEnabled iPhone
NSZombieEnabled iPhone  NSZombieEnabled Trouble in setting How can i set the NSZombieEnabled in iPhone application to track unmanaged memory
Offshore iPhone Development
Offshore iPhone Development With the evolution of Apple's iPhone (internet... marketing owner of iPhone - has first time introduced unique integrated features... application software for iPhone and stored on iTune - Apple's multimedia
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'
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
How to Changing Toolbar Color using iPhone Application ?
the online reference or example of how to change toolbar color in iPhone Apps...How to Changing Toolbar Color using iPhone Application ?  Hi, i have developing a small application to changing the toolbar color in iphone. But i
ModuleNotFoundError: No module named 'config-handle'
ModuleNotFoundError: No module named 'config-handle'  Hi, My... 'config-handle' How to remove the ModuleNotFoundError: No module named 'config-handle' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'config-handle'
ModuleNotFoundError: No module named 'config-handle'  Hi, My... 'config-handle' How to remove the ModuleNotFoundError: No module named 'config-handle' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'doc-handle'
ModuleNotFoundError: No module named 'doc-handle'  Hi, My Python... 'doc-handle' How to remove the ModuleNotFoundError: No module named 'doc-handle' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'doc-handle'
ModuleNotFoundError: No module named 'doc-handle'  Hi, My Python... 'doc-handle' How to remove the ModuleNotFoundError: No module named 'doc-handle' error? Thanks   Hi, In your python environment you
iPhone Application Development
and handle all iPhone projects, build, run, edit and debug source files... iPhone Application Development       The Apple iPhone is a great device that supports a host
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
iphone nsurlrequest authentication
iphone nsurlrequest authentication   How to authenticate a form in iPhone Application
Version of com.gluonhq>charm-down-plugin-orientation dependency
List of Version of com.gluonhq>charm-down-plugin-orientation dependency
what is json in iphone sdk
what is json in iphone sdk  What is json in iphone sdk? Is this a library and when i need to include JSon in my iPhone SDK App
iphone
iphone
iphone
iphone
JSP handle run-time exceptions
JSP handle run-time exceptions  How does JSP handle run-time exceptions?   You can use the errorPage attribute of the page directive to have uncaught run-time exceptions automatically forwarded to an error processing
info button iphone example
info button iphone example  I'm looking for a simple info button example in iPhone XCode. Thanks
iphone storing and fetching data
iphone storing and fetching data  How to store and fetch data in an iphone application
iPhone show activity indicator
iPhone show activity indicator  Hi, How to show activity indicator in iPhone application? Thanks
iPhone - MFMailcomposeviewcontroller example
iPhone - MFMailcomposeviewcontroller example  Hi! I'm looking for a mfmailcomposeviewcontroller example for both iPhone and iPad. Any suggestion?? Thanks
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
calling from iphone through programitically in iphone
calling from iphone through programitically in iphone  calling from iphone through programitically in iphone please help me my senario is if i click send sms button message should deliver to xyz person and that xyz person make
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. Selection: Make selection by the Magic wand tool
How to use java.net.URLConnection to fire and handle HTTP requests?
How to use java.net.URLConnection to fire and handle HTTP requests?  How to use java.net.URLConnection to fire and handle HTTP requests

Ads