Has anyone had any experience of using the IOS UIKit plugin in a landscape mode project? I've tried the example and it always seems to present the UI elements in portrait orientation.
@phongtt, I just took a look at Whack the Zombie. I only have the free version so clicking the Game Center icon puts up an alert saying I need to make an IAP. Sure enough that alert works fine in landscape mode.
How do you put up that alert? Is it done by uikit.mm or gamekit.mm? If the former, how are you putting your app into landscape mode? I have tried changing the Gideros project settings and using application:setOrientation(Application.LANDSCAPE_LEFT).
There's a bug in the Gideros Player Xcode project where the UIInterfaceOrientation events aren't being fired for the generic player in GiderosiPadPlayerViewController.mm. (My bad - I haven't got around to create a unit test and submitting it to the bugbase yet.)
You can test this if you create a UIWebView for landscape. If you run it on the device or the XCode Simulator, the view doesn't get the correct frame and you actually have to restart the Gideros Player via Gideros Studio a few times before it works in the correct orientation. ie. Just hit Command-R a few times from the studio. You may need to rotate the device manually as well, to get it to fire an UIInterfaceOrientation event.
The good news is that if you export the project from Gideros Studio, the compiled binary via Xcode does detect the correct orientation upon launch. The bug is only using the development player (which is still pretty annoying to live with, but bearable.)
So the UIKit does work correctly in landscape mode but it is just a little difficult to get the player to realise which mode it is in when it starts off. As you say, if you shake the device about a bit it seems to get it right eventually.
Just in case anyone else is annoyed by this issue (where the player doesn't set the correct orientation for the UIView layer initially), there is a temporary fix in this thread. You'll need to be using the BhWax plugin to make use of it.
Comments
Have you checked my game: Whack the Zombie? (Touch on the Game Center icon in main menu)
It works fine for me.
How do you put up that alert? Is it done by uikit.mm or gamekit.mm? If the former, how are you putting your app into landscape mode? I have tried changing the Gideros project settings and using application:setOrientation(Application.LANDSCAPE_LEFT).
best regards
Ah, and I didn't use the setting of Gideros Studio nor setOrientation. I used the landscape setting of Xcode.
You can test this if you create a UIWebView for landscape. If you run it on the device or the XCode Simulator, the view doesn't get the correct frame and you actually have to restart the Gideros Player via Gideros Studio a few times before it works in the correct orientation. ie. Just hit Command-R a few times from the studio. You may need to rotate the device manually as well, to get it to fire an UIInterfaceOrientation event.
The good news is that if you export the project from Gideros Studio, the compiled binary via Xcode does detect the correct orientation upon launch. The bug is only using the development player (which is still pretty annoying to live with, but bearable.)
- Ian
Likes: phongtt
So the UIKit does work correctly in landscape mode but it is just a little difficult to get the player to realise which mode it is in when it starts off. As you say, if you shake the device about a bit it seems to get it right eventually.
best regards
best regards