Force orientation to portrait only on phone

This commit is contained in:
ismailgulek 2021-02-15 17:46:49 +03:00
parent 08acf9d5fc
commit dd5add280d

View file

@ -107,6 +107,12 @@
[self.endCallButton setImage:hangUpButtonImage forState:UIControlStateNormal];
[self.endCallButton setImage:hangUpButtonImage forState:UIControlStateHighlighted];
// force orientation to portrait if phone
if ([UIDevice currentDevice].isPhone)
{
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger: UIInterfaceOrientationPortrait] forKey:@"orientation"];
}
[self updateLocalPreviewLayout];
[self configureUserInterface];
@ -152,6 +158,30 @@
[super viewWillDisappear:animated];
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
// limit orientation to portrait only for phone
if ([UIDevice currentDevice].isPhone)
{
return UIInterfaceOrientationMaskPortrait;
}
return [super supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
if ([UIDevice currentDevice].isPhone)
{
return UIInterfaceOrientationPortrait;
}
return [super preferredInterfaceOrientationForPresentation];
}
- (BOOL)shouldAutorotate
{
return NO;
}
#pragma mark - override MXKViewController
- (UIView *)createIncomingCallView