Home Tutorial Iphone Examples Orientation iPhone SDK

 
 

Share on Google+Share on Google+
Orientation iPhone SDK
Posted on: April 26, 2010 at 12:00 AM
Advertisement
While developing the application in iPhone please keep in mind that landscape orientation is not possible in the case of TabBar application. Every time you need to hide the tabbar whenever orientation is changed from portrait to landscape.

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 of TabBar application. Every time you need to hide the tabbar whenever orientation is changed from portrait to landscape.

But certainly it's possible in navigation based application. So, in this example .. we are developing a navigation based application that is both portrait and landscape orientation enabled.

Steps
Create a new UINavigation based application, assign name to it and save the app.

Create a mutable array and add objects to it, and then call in then configure the cell with array object in cellForRowAtIndexPath.
It will allow you to show the array data on cell. But that's option you can check orientation without data as well.

Uncomment shouldAutorotateToInterfaceOrientation method in implementation file and "return YES;" as it sets the application in both portrait and landscape mode.

Build and test your application.. it must look alike the given images.


You can also set the landscape orientation for UIVIew, UIScrollView etc... method is same. But if you want your application to support only landscape mode then either you can change it from .plist by adding given lines to it...
<key>UIInterfaceOrientation</key>
<string>UIInterfaceOrientationLandscapeRight</string>

or
simply set
[setOrientation:UIInterfaceOrientationLandscapeRight]; in shouldAutorotateToInterfaceOrientation method. It will work.

Download the code

Advertisement

Related Tags for Orientation iPhone SDK:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 26, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com