我有一个标题中提到的问题。

根据此answer它在ViewDidAppear的ViewController中执行。
但是,如何将这段代码导入java以及在的情况下在哪里调用它,我想在游戏结束后更改旋转角度。

我试图做这样的事情:

long landscapeOrientation = UIInterfaceOrientation.LandscapeLeft.value();
UIDevice.getCurrentDevice().getKeyValueCoder().setValue("orientation", landscapeOrientation);

卡住了,因为我需要NSObject ...

最佳答案

感谢Robovm's gitter的Demyan Kimitsa。

long landscapeOrientation =  UIInterfaceOrientation.LandscapeLeft.value();
UIDevice.getCurrentDevice().getKeyValueCoder().setValue("orientation", NSNumber.valueOf((int) landscapeOrientation));

07-28 03:56