i3Factory World

Your Iphone, iPad & Android Application Factory

Browsing Posts published in January, 2011

To automatically support orientations in your iPhone and iPad apps we have to do 3 things:
1) Provide launch images
2) Update your Info.plist settings
3) Implement the -shouldAutorotateToInterfaceOrientation: method.
IMPORTANT: It is strongly recommended that your application support all orientations. This includes portrait, portrait upside-down, landscape left and landscape right. iPad apps that require an orientation must support both variants of that orientation.

1) Provide Launch Images

IMPORTANT: All file names are case sensitive.
iPhone-only applications:
iPhone-only applications may only have one launch image. It should be in PNG format and measure 320 x 480 pixels. Name your launch image file Default.png.
For iPhone 4 high resolution, you can include an additional launch image. It should be in PNG formate and measure 640 x 960 pixels. Name it Default@2x.png. This image will get picked up by the iOS if your app is running on an iPhone 4.
Note: If your app is not running on an iPhone 4, and you provided both Default.png and Default@2x.png, iOS will automatically pick up Default.png as the launch image.
iPad-only applications:
Create a launch image for each supported orientation in the PNG format. Each launch image must be 1004 x 768 pixels (for landscape) or 748 x 1024 pixels (for portrait).
Default launch image files:
  • Default-PortraitUpsideDown.png – upside-down portrait version.
  • Default-LandscapeLeft.png – left-oriented landscape version.
  • Default-LandscapeRight.png – right-oriented landscape version.
  • Default-Portrait.png – generic portrait version.
  • Default-Landscape.png – generic landscape version.
  • Default.png – default portrait launch. Its usage is strongly discouraged, use more specific launch images instead.
Note: For iPad-only applications, it is common application to provide only Default-Portrait.png and Default-Landscape.png. More specific launch images will take precedence over the generic versions, for example Default-PortraitUpsideDown.png takes precedence over the Default-Portrait.png image file for this specific orientation.
See the ios reference guide site “Providing Launch Images for Different Orientations” section on the iPad Programming Guide for more information.
Universal applications:
Include launch images for both iPhone and iPad. iPhone launch image will still be named Default.png and Default@2x.png. Name your iPad portrait launch image Default-Portrait.png (do not use Default.png as the iPad portrait launch image).

Update Your Info.plist Settings

In your Info.plist file:
  • Specify values for the UISupportedInterfaceOrientations key for the supported orientations.
  • Specify values for the UIInterfaceOrientation key for the initial launch orientation.
3) Method
This method returns which orientations are allowed (Portrait, PortraitUpsideDown, LandscapeLeft and LandscapeRight). Calling this method would not do anything as your class shouldn’t change the orientation dynamically.

That method doesn’t cause the interface to rotate, it just decides if the device is ALLOWED to.

So if you want to change the factors you use to determine if rotating is allowed, you’ll have to create an instance variable.

make your header have something like this:

@interface MyClassName : NSObject {     BOOL canLandscape; } 

In your “other” method, set that flag (canLandscape = YES;).

In your shouldAutorotateToInterfaceOrientation:, you can check this to help you decide

if (canLandscape) {     ...dosomethinghere... }  

i3Factory has Pubblished on App Store Varese Focus Magazine

This public magazine is using The i3F Editorial System: here for information about publish your magazine

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.