PLEASE HELP - Orientation not working in Xcode

@Simeon: I need some help because the supportedOrientation does not work in Xcode. Please check my post in the questions section.

@eriksw set orientions on Xcode

When you get to XCode you’ll just need to specify the supported orientations. It’'s very simple and quick to do.

Guys, please read that post before commenting. This case is a bit more complex than just setting the supported orientations in Xcode.

What post should we read? Can you provide a link please?

It’s this one:

http://codea.io/talk/discussion/6495/supported-orientation-not-working-like-i-want-it-to#latest

Why don’t you just save yourself a lot of trouble and pick an orientation for your game, either landscape or portrait? Doesn’t seem to be possible to do what you are trying to do.

@eriksw I would try keeping it in Landscape and using the gyroscope to detect the orientation of the device yourself. Then you can change some global variables that effect how things are drawn to fit the new orientation.

Hi - Sorry about not responding in your other thread, I never got around to checking why my answer wasn’t working right.

As for @Crumble, it’s certainly possible - just look at Codea which does it through it’s supportedOrientations command.

Perhaps the easiest way would be to ask @Simeon for the Obj-C code that supportedOrientations calls so that you can adapt it for your needs?

@goatboy: that would mean completely rewriting the program. Don’t fancy that, WAY too much work. If I had known that supportedOrientations does not work in the app once it is published, I might have taken that approach from the start. Too late now.
@Crumble: the whole point of this thread is that I DO want the app to run in the users favourite orientation, and I can’t seem to get that to work, even though it is a very simple requirement - or at least it SHOULD be…

@JakAttak: sounds like an idea. Is @Simeon reading this ?

@eriksw sounds like you should be able to do what you’re trying to do. I’ll look into it. Just to get things clear: You want your exported game to support only landscape orientations? And you have ensured that only landscape orientations are checked in Xcode in your project settings?

@Simeon I think he wants his app to stay in the orientation it was in when it started, which seems to be difficult.

@Simeon: thanks for looking into this. Here’s my problem:

In my app I use a lot of large images, which are loaded when the app starts. The app (a cellular automaton) is made so it can work in landscape OR portrait mode, so on start-up it checks the orientation and then loads only the relevant images for that mode. Once started, the app must stay in the orientation it started in, so it should not react to rotation, unless it is a full 180 degrees (but it would not be a problem if it would stay locked in the initial orientation, even when rotated 180 degrees).

So I need to check all orientations in Xcode so it can be started in either portrait or landscape mode, but once running it should be impossible to switch from landscape to portrait or vice versa.

More details on how I tried to do this in this thread:

http://codea.io/talk/discussion/6495/supported-orientation-not-working-like-i-want-it-to#latest

If you could solve this I would be most grateful. All the rest of the app is working fine, it’s just this last detail that would make it work like it should for the full 100%.

@eriksw not solving your problem, but a potential workaround (though difficult to know without full context). Could you detect the orientation change and send the program into a paused state instead?

@west: not sure what you mean, but this is an image generator so pausing is out of the question

Ok I was not going to “launch” this app before solving this problem but you can check this page to see what it is:
http://www.yourapphere.nl

It’s already in the App Store, but that version only works in landscape mode - which is the way I prefer it, but other people like portrait better so I want it to load so it works in the orientation it starts in, and then rotation should either be completely locked or (best) only allow 180 degree rotation.

I’ve never used an app where the orientation is locked to whatever it is at launch. So if I wanted to switch orientation, I’d have to force quit then relaunch?

Yes. There’s a first time for everything… :slight_smile:

There’s 2 reasons:

  1. The app uses a lot of large images that are different for each orientation. The app now loads only the relevant images, which makes start-up twice as fast.

  2. Once the cellular automaton is running the algorithm works through the array from top to bottom. So switching orientation will switch the amount of lines & columns, which makes no sense / is not supposed to happen in a cellular automaton while it runs.

It would have been possible if I had written the algorith to work from top to bottom in landscape, and from left to right in portrait mode, but since I decided to lock the orientation once running (for reason 1 mentioned above) I did not write it like that, and I don’t feel like completely rewriting it just because supportedOrientation is not working as it is supposed to…