我努力修改設備方向。我發現這個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