Different orientations with iPhone and iPad

I’m creating an app that will run in portrait mode on an iPhone, but in landscape mode on an iPad. However, I can’t figure out a way to be able to choose which device is used in the build.settings file (because it’s not lua I can’t check the device name). Does anyone know a way to change which orientation is default based on device?
Thanks!
Peter [import]uid: 38000 topic_id: 35120 reply_id: 335120[/import]

Hi Peter,
This will take a bit of jury-rigging, but it should be possible. You can detect iPad vs. iPhone/Pod using the methods described in the link below. Then, you’ll have to use that info to manually position/reorient your screen setup.

http://www.coronalabs.com/blog/2012/12/11/device-detection-on-steroids/

Hope this helps,
Brent [import]uid: 200026 topic_id: 35120 reply_id: 139695[/import]

I know how to detect which device I’m on, but I wasn’t sure what was the best way to change the orientation based on that. Is there a way to programmatically change the orientation in my code? Or do I just have to do it myself and move and rotate all my graphics 90 degrees? [import]uid: 38000 topic_id: 35120 reply_id: 139733[/import]

Hi Peter,
The latter is probably what you’ll be forced to do. You can, of course, sense when the orientation changes in Corona, but it wouldn’t help much because you’ll still need to shift graphics/objects/UI around to accommodate the new orientation. I don’t see another way around it. :wink:

Brent [import]uid: 200026 topic_id: 35120 reply_id: 139747[/import]

Would it be possible to just rotate the whole display group at once? [import]uid: 38000 topic_id: 35120 reply_id: 139748[/import]

Sure, I don’t see why not. My only caution would be if you’re using physics: I tell everybody not to shift/rotate groups with physics objects as that will throw off the collision system. Otherwise, I see no major risks in your idea.

Brent [import]uid: 200026 topic_id: 35120 reply_id: 139752[/import]

Hi Peter,
This will take a bit of jury-rigging, but it should be possible. You can detect iPad vs. iPhone/Pod using the methods described in the link below. Then, you’ll have to use that info to manually position/reorient your screen setup.

http://www.coronalabs.com/blog/2012/12/11/device-detection-on-steroids/

Hope this helps,
Brent [import]uid: 200026 topic_id: 35120 reply_id: 139695[/import]

I know how to detect which device I’m on, but I wasn’t sure what was the best way to change the orientation based on that. Is there a way to programmatically change the orientation in my code? Or do I just have to do it myself and move and rotate all my graphics 90 degrees? [import]uid: 38000 topic_id: 35120 reply_id: 139733[/import]

Hi Peter,
The latter is probably what you’ll be forced to do. You can, of course, sense when the orientation changes in Corona, but it wouldn’t help much because you’ll still need to shift graphics/objects/UI around to accommodate the new orientation. I don’t see another way around it. :wink:

Brent [import]uid: 200026 topic_id: 35120 reply_id: 139747[/import]

Would it be possible to just rotate the whole display group at once? [import]uid: 38000 topic_id: 35120 reply_id: 139748[/import]

Sure, I don’t see why not. My only caution would be if you’re using physics: I tell everybody not to shift/rotate groups with physics objects as that will throw off the collision system. Otherwise, I see no major risks in your idea.

Brent [import]uid: 200026 topic_id: 35120 reply_id: 139752[/import]