Different orientation support on different devices

I’m trying to make my universal app support landscape orientations only for iphone and portrait orientations only for ipad.

However, I’m scratching my head a bit on getting the build.settings file set up properly.

Is anyone familiar with how to set this up?

I also posted this in the Universal Binaries forum, but it’s not getting any love over there and is a serious “show stopper” for us right now.

Thanks!
-Eric
[import]uid: 9187 topic_id: 7366 reply_id: 307366[/import]

Check this blog post out :slight_smile:

http://blog.anscamobile.com/2011/01/use-dynamic-layouts-in-universal-builds-with-corona-sdk/ [import]uid: 8872 topic_id: 7366 reply_id: 26007[/import]

Thanks for the link, but this refers to detecting the device inside config.lua and I am good there.

My problem is the default and supported orientations inside build.settings

I started my app with the intent to release two versions. iPhone version was built in landscape, and iPad version was built in portrait because the space was better used this way.

Now with the option to build universal I would like to do so, but I need the app to default/support only landscape when iPhone and default/support only portrait when iPad.

I have it working great with two different build.settings files. Swapping them out depending on which device I’m going to test on.

If you have any input on this issue it would be greatly appreciated. Thanks! [import]uid: 9187 topic_id: 7366 reply_id: 26015[/import]

Eric, can you add conditional code to your build.settings file that sets it up differently based on which device is running, the same as the config file example in that blog post? [import]uid: 9905 topic_id: 7366 reply_id: 26026[/import]

Re-posted now that the specific bug has been found.

http://developer.anscamobile.com/forum/2011/03/03/creating-device-specific-infoplist-keys-crashes-compiler [import]uid: 9187 topic_id: 7366 reply_id: 26053[/import]

Eric’s build.settings file looks good. That would be the way to lock orientation per device. Unfortunately, there is a bug that crashes Corona.

We’re aware of the bug and it’s filed in our bug base, case #3925. We’ll make an announcement as soon as it’s fixed. You’re not the only one who wants this!

There’s no other way to lock orientation per device right now.

[import]uid: 5917 topic_id: 7366 reply_id: 26341[/import]

I’m having an issue related to this. I have an app that needs to be in landscape mode on iPad and portrait mode on iPhone. Using the code below I can get the iPad version to show the content in the correct orientation but the simulator always starts in portrait mode and the X, Y axis default to portrait mode. Basically, the iPad content is aligned as if it was on portrait mode instead of landscape mode. Is there any way to solve this?

Thanks,
Andre

build.settings
[lua]settings =
{
orientation =
{
default = “portrait”,
supported =
{
“portrait”,
“portraitUpsideDown”,
“landscapeRight”,
“landscapeLeft”
},
},
iphone =
{
plist =
{
UIInterfaceOrientation = “UIInterfaceOrientationPortrait”,
UISupportedInterfaceOrientations =
{
“UIInterfaceOrientationPortrait”,
“UIInterfaceOrientationPortraitUpsideDown”
},
UIApplicationExitsOnSuspend = false,
UIStatusBarHidden = true,
UIPrerenderedIcon = true,
CFBundleIconFile = “Icon.png”,
CFBundleIconFiles =
{
“Icon.png”,
“Icon@2x.png”,
“Icon-Small@2x.png”,
“Icon-72.png”,
“Icon-Small-50.png”,
“Icon-Small.png”,
“Icon-64.png”,
“Icon-32.png”,
“Icon-24.png”,
“Icon-16.png”
},
UIAppFonts =
{
“assets/fonts/HelveticaNeueLTPro-Bd.ttf”,
“assets/fonts/HelveticaNeueLTPro-Roman.ttf”,
},
}
}
}
settings.iphone.plist[“UIInterfaceOrientation~ipad”] = “UIInterfaceOrientationLandscapeRight”
settings.iphone.plist[“UISupportedInterfaceOrientations~ipad”] =
{
“UIInterfaceOrientationLandscapeRight”,
“UIInterfaceOrientationLandscapeLeft”
}[/lua]

config.lua
[lua]application =
{
content =
{
width = 1024,
height = 768,
scale = “none”,
},
}[/lua] [import]uid: 10048 topic_id: 7366 reply_id: 45513[/import]