iphone handle orientation change

Ads
 

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
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
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
java exception handle
java exception handle  How error can be handled in the exception class?? can we handle fatal error in java
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
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 call
Iphone call  Do you have other method to make a call on Iphone,without openUrl
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
Change Email
Change Email  Hi, I need to change my Rose India register email address for receive email, How did it possible
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
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
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
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
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
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
Version of com.gluonhq>charm-down-plugin-orientation dependency
List of Version of com.gluonhq>charm-down-plugin-orientation dependency
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
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

Ads