iphone handle orientation change

Ads

 
 

Share on Google+Share on Google+

Java Coder
iphone handle orientation change
2 Answer(s)      6 years and 9 months ago
Posted in : MobileApplications

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

Thank in Advance!

Ads
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
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.... UIControlStateHighlighted iPhone SDK App - Change UIButton Text on Different States... = 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:       In this tutorial will learn button change view i.e. when button is clicked will move to next view. This application is View Based
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
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
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
How to Handle Event Handlers?
How to Handle Event Handlers?  How to Handle Event Handlers
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
java exception handle
java exception handle  How error can be handled in the exception class?? can we handle fatal error in java
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
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
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 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 Regards
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
You handle your own transaction
You handle your own transaction  How do you handle your own transaction
Version of com.gluonhq>charm-down-plugin-orientation dependency
List of Version of com.gluonhq>charm-down-plugin-orientation dependency
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
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
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
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