如何强制旋转iOS的屏幕?

如何强制旋转iOS的屏幕?,ios,objective-c,iphone,jailbreak,tweak,Ios,Objective C,Iphone,Jailbreak,Tweak,我正在为越狱iOS设备编写一个调整,它与设备方向密切相关,它应该强制整个屏幕到指定的方向,并将其保持在该方向。这个调整在SpringBoard和Backboardd中运行,我尝试了下面的代码,但没有成功。有人知道吗 NSNumber *value = [NSNumber numberWithInt:orientation]; [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; 在viewdide:method中调用相

我正在为越狱iOS设备编写一个调整,它与设备方向密切相关,它应该强制整个屏幕到指定的方向,并将其保持在该方向。这个调整在
SpringBoard
Backboardd
中运行,我尝试了下面的代码,但没有成功。有人知道吗

NSNumber *value = [NSNumber numberWithInt:orientation];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
viewdide:
method中调用相同的代码(我在下面写的代码)。

目标C:-

NSNumber *value = [NSNumber numberWithInt:orientation];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
斯威夫特:-

let value = UIInterfaceOrientation.orientation.rawValue
UIDevice.currentDevice().setValue(value, forKey: "orientation")

也许您可以使用这段代码,NSNumber*value=[NSNumber numberwhint:uiinterface-orientationlandscapeleft];[[UIDevice currentDevice]设置值:值forKey:@“方向”];代码在SpringBoard和BackboardDD中运行,因此没有可用的viewDidApear。