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];

        }
    }









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
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
Change Button Text iPhone
Change Button Text iPhone In a UINavigationController based application, most.... But luckily we can change the button text in iPhone app. Find the given code that will change the text on the back button. You can also give it a Title of your
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 Change Button Text
iPhone Change Button Text The example illustrate how to change the text.... UIControlStateHighlightedADS_TO_REPLACE_1 iPhone SDK App - Change UIButton Text... = 0xFF000000 }; In our example we are going to change the text
iphone button change view
iphone button change view Final application will look like this:      ADS_TO_REPLACE_1 In this tutorial will learn button change view i.e. when button is clicked will move to next view. This application
iPhone Font Size
iPhone Font Size In this example we are going to change the iphone font size and color. You can change the font size and font type using the Inspector that resides in Interface Builder->Tools. It has the number of font
iphone
iphone  hiii, how can we use table recursively in iphone
iphone
iphone  hello... i want to make first iphone application . How can i make it plz help me
iphone
iphone  How can connect with the other database in iphone application(like... MYsql or oracle) is this dirctly possible
iPhone landscape mode
iPhone landscape mode In this series of iPhone application development tutorial, you'll learn launching your iPhone app in landscape mode. Believe me it's very simple to change your iphone app in landscape mode. Just follow
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
UINavigationBar Color - iPhone example
UINavigationBar Color - iPhone example The example is discussing about how to change the color of UINavigationBar. In iPhone applications you can customize the UINavigationBar and change their color either programmatically or by Interface
How to Handle Event Handlers?
How to Handle Event Handlers?  How to Handle Event Handlers
iphone button example
 iphone button example In this tutorial we will tell you how to change the type of button in Interface Builder. There are six types of iPhone button, each has used for different purpose.  1. Custom  2. Rounded
Iphone Developmnt
Iphone Developmnt  i am making an application in ios, for ipad or iphone, what i want to know is that can i provide an option of changing the theme... to next customer, i can change the look and feel please guide me through
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
JSP handle runtime exceptions
JSP handle runtime exceptions  How does JSP handle runtime exceptions?   Using errorPage attribute of page directive and also we need to specify isErrorPage=true if the current page is intended to URL redirecting
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
color change
color change  how to change the color in circle using scrollbar
You handle your own transaction
You handle your own transaction  How do you handle your own transaction
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
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
iphone Button Action (changing background of window)
iphone Button Action (changing background color of window)   In this tutorial we will change the background color on clicking the button, This is Window Based application. Final application will look like this: In .h
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 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
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'
iPhone TabBar Application Tutorial - UITabBar
iPhone TabBar Application Tutorial - UITabBar The basic idea behind using.... In iPhone programming you can see that the UITabBar actually implements a modal interface that change the UIView on tapping it. You can have number of Tab Bar items
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 '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
NSZombieEnabled iPhone
NSZombieEnabled iPhone  NSZombieEnabled Trouble in setting How can i set the NSZombieEnabled in iPhone application to track unmanaged memory
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
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
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 resignfirstresponder
iPhone resignfirstresponder  Hi, Provide me a good example of iPhone resignfirstresponder. I need a code to hide keyboard when use clicks outside the text box. ThanksADS_TO_REPLACE_1   Hi, You can use the following
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
iPhone SDK Examples
While developing the iPhone program, many times you need some code to copy.... are presented here. We will discuss all the UI and other components of the iPhone SDK... components. Windows Buttons Fonts Text Orientation
Version of com.gluonhq>charm-down-plugin-orientation dependency
List of Version of com.gluonhq>charm-down-plugin-orientation dependency

Ads