Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Mobile-Applications iphone handle orientation change
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Java Coder
iphone handle orientation change
2 Answer(s)      4 years and a month ago
Posted in : MobileApplications


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

Thank in Advance!


Advertisement
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
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
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
iphone
iphone  hiii, how can we use table recursively in iphone
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
iphone
iphone  How can connect with the other database in iphone application(like... MYsql or oracle) is this dirctly possible
iphone
iphone  hello... i want to make first iphone application . How can i make it plz help me
How to Handle Event Handlers?
How to Handle Event Handlers?  How to Handle Event Handlers
Marketing orientation: way for marketing
Marketing orientation is the marketing approach in which need and demand... orientation emphasizes to the want and need of customer so that company can win the trust of customer for the future prospect. Marketing orientation practices
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
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 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
Customer orientation in marketing management
on customers demand and their taste. It is known as the customer orientation... are utilizing the marketing concept, which based on customer orientation. Although success... depends upon the customer orientation move. Such companies focus on the need
You handle your own transaction
You handle your own transaction  How do you handle your own transaction
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 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
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
How to handle enter key in javascript
How to handle enter key in javascript  Can any one tell me how to handle the enter key event on a Button in HTML. Like in my simple HTML page i want to submit the form even if user hits the enter key from keyboard instead
color change
color change  how to change the color in circle using scrollbar
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 Graphics
iPhone Graphics  Hi, How to create iPhone Graphics? I am learning to crate UI Design for iPhone and iPad. Thanks
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
 

 

 

DMCA.com