【问题标题】:LibGDX on iOS: Rotate screen programmatically using RobovmiOS 上的 LibGDX:使用 Robovm 以编程方式旋转屏幕
【发布时间】:2020-01-09 14:26:35
【问题描述】:
我有一个我在标题中提到的问题。
根据这个answer它在ViewDidAppear的ViewController中做了。
但是如果我想在游戏的某个时间点改变旋转,如何将这段代码导入java以及在哪里调用它。
我试图做这样的事情:
long landscapeOrientation = UIInterfaceOrientation.LandscapeLeft.value();
UIDevice.getCurrentDevice().getKeyValueCoder().setValue("orientation", landscapeOrientation);
卡住了,因为我需要 NSObject...
【问题讨论】:
标签:
java
ios
libgdx
robovm
【解决方案1】:
感谢来自Robovm's gitter 的 Demyan Kimitsa。
long landscapeOrientation = UIInterfaceOrientation.LandscapeLeft.value();
UIDevice.getCurrentDevice().getKeyValueCoder().setValue("orientation", NSNumber.valueOf((int) landscapeOrientation));