我努力修改设备方向。我发现这个cordova插件https://github.com/gbenvenuti/cordova-plugin-screen-orientation,它与cordova应用程序一起工作,但不幸的是,它不能使用IBM MobileFirst Platform Foundation 7.0(+ Angular,Ionic)。无法锁定和解锁屏幕方向
我也试着做小搓到屏幕方向科尔多瓦根据本https://forums.developer.apple.com/thread/6165插件,但它仍然没有工作
这是接口它看起来YoikScreenOrientation.h
@interface ForcedViewController : UIViewController
@property (strong, nonatomic) NSString *calledWith;
@end
和YoikScreenOrientation.m
@implementation ForcedViewController
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
- (NSUInteger)supportedInterfaceOrientations {
NSLog(@"lockViewController to ALL Portrait < 9");
return UIInterfaceOrientationMaskPortrait;
}
#else
-(UIInterfaceOrientationMask)supportedInterfaceOrientations{
NSLog(@"lockViewController to ALL Portrait > 9");
return UIInterfaceOrientationPortrait;
}
#endif
@end
我可以在日志中看到它通过了supportedInterfaceOrientations
方法,但它不会将屏幕方向锁定为纵向。有没有我错过的配置来锁定或解锁设备方向?
1)最终目标是什么?您是否尝试以编程方式完成锁定和解锁,而不是常规选项中的设备方向选项? 2)Angular和Ionic与这个问题有什么关系? 3)您是在物理设备还是在iOS模拟器中测试? –
1)目标是将屏幕方向锁定在一个页面中,然后再次解锁,我添加了常规选项未锁定的图像,指出设备方向已解锁。 2)没有什么只是它用来构建应用程序的框架,3)是的,我在模拟器和真实设备上都进行了测试,这是同样的行为。 – Jan