From fdea674773ad1b1da2c414fdb3ccdd80f6c75319 Mon Sep 17 00:00:00 2001 From: REIS Benjamin Date: Mon, 3 Oct 2016 13:50:06 +0200 Subject: [PATCH] fix landscape view of camera --- Classes/ImagePickerView.m | 18 ++++++++++++++++++ Classes/LinphoneAppDelegate.m | 11 +++++++++++ 2 files changed, 29 insertions(+) diff --git a/Classes/ImagePickerView.m b/Classes/ImagePickerView.m index 6208e46e9..7f8fa79e8 100644 --- a/Classes/ImagePickerView.m +++ b/Classes/ImagePickerView.m @@ -43,6 +43,20 @@ return self; } +- (BOOL) shouldAutorotate{ + return NO; +} + +#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000 +- (NSUInteger)supportedInterfaceOrientations { + return UIInterfaceOrientationMaskPortrait; +} +#else +- (UIInterfaceOrientationMask)supportedInterfaceOrientations{ + return UIInterfaceOrientationMaskPortrait; +} +#endif + #pragma mark - UICompositeViewDelegate Functions static UICompositeViewDescription *compositeDescription = nil; @@ -93,6 +107,10 @@ static UICompositeViewDescription *compositeDescription = nil; setStatusBarStyle:UIStatusBarStyleDefault]; // Fix UIImagePickerController status bar style change [PhoneMainView.instance hideStatusBar:YES]; + + //Prevent rotation of camera + NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait]; + [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; } - (void)viewWillDisappear:(BOOL)animated { diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 177b09a36..524433cbd 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -740,4 +740,15 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response [LinphoneManager.instance startLinphoneCore]; } +- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { + if ([[(PhoneMainView*)self.window.rootViewController currentView] equal:ImagePickerView.compositeViewDescription]) + { + //Prevent rotation of camera + NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait]; + [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; + return UIInterfaceOrientationMaskPortrait; + } + else return UIInterfaceOrientationMaskAll; +} + @end