Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

iOS and MacOS / How to force the orientation you want without flipping

Author
Message
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 26th Jul 2012 19:54
My WIP game requires exactly one orientation.

In Tier 1, I was able to force this in the UntitledViewController.m shouldAutorotateToInterfaceOrientation function by return YES or NO as desired instead of using the agk::CanOrientationChange function.

In Tier 2, if I did the same thing and was forcing to a landscape mode and using SetVirtualResolution, it totally messed up the display resolution. I can repeat this reliably 100%.

So, I added a display to see what the reported orientation was and flipped about to see what was reported for the two landscape modes (Apple calls them Left and Right, depending upon which side the home button is on).

As reported in another post somewhere, the Left and Right do not line up with orientations 3 and 4 as might be expected.

So, I changed this:


to this:


And, lo and behold, when I used agk::SetOrientationAllowed(0,0,1,0) and specified only Landscape Right in the deployment info in Xcode, it worked exactly as I wished!

It displayed in only Landscape Right and would not flip!

Cheers,
Ancient Lady
AGK Community Tester
FakeBlood
21
Years of Service
User Offline
Joined: 18th Nov 2002
Location: Alabama, United States
Posted: 26th Jul 2012 20:28
Great find! I'll have to remember this for when I make it that far with a project until (if) it gets corrected.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 26th Jul 2012 22:08
agk::SetOrientationAllowed(0,0,1,1) should be enough to make your app landscape.

why go into all the trouble of doing all these changes?
What am i missing?
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 26th Jul 2012 22:22
My app absolutely must be in exactly one orientation to play properly. So allowing both landscape options is not an option for this app.

Cheers,
Ancient Lady
AGK Community Tester
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 28th Jul 2012 00:00
last year i released my first ipad app. apple rejected it because it was only in 1 orientation. before that i had released 3 iphone apps and all used 1 orientation and there were no problems there.

so keep this in mind when dealing with apple. try to have a plan B is they reject it the first time
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 28th Jul 2012 00:10
I expect to get the orientation issue with them and am prepared with my argument about the necessity because of how the game is played. I think I'll win.

Cheers,
Ancient Lady
AGK Community Tester
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 29th Aug 2012 14:46
Where can I specify both Landscape Left & Right in the "deployment info" in Xcode3 so that my app starts up as landscape and stays landscape?
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Aug 2012 16:53
I don't have Xcode3, but in Xcode4 it is in the 'Summary' page when you click on the project in the left hand navigation pane and then on the project under 'TARGETS' in the inner left column of the middle main column in the Xcode interface.

I have no idea if Xcode3 is set up at all the same. You should be able to search in the help for the Deployment Info/Supported Device Orientations area (which is where you select the orientations).

Cheers,
Ancient Lady
AGK Community Tester
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 29th Aug 2012 21:12
no xcode 3 is totally different, that's the problem!!!!
it used the info.plist but i have no idea of the proper syntax i have to input even after 1 day of searching
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 29th Aug 2012 21:40
Solution for Xcode3:

1. copy All 7 files in apps / Interpreter ios/ Classes to your project directory Classes folder

2. edit untitledviewcontroller.m
replace #include "interpreter.h" with #include "template.h"

3. edit template-info.plist
add a new array key UISupportedInterfaceOrientations
add strings UIInterfaceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeRight


there is no need to edit screen sizes in the template files or use agk:rientationChanged

Enjoy!

Login to post a reply

Server time is: 2024-04-16 06:52:20
Your offset time is: 2024-04-16 06:52:20