Objective-C - Locking rotation in ABPeoplePickerNavigationController
-
22-04-2021 - |
Question
My app uses only portrait mode. But ABPeoplePickerNavigationController supports landscape. Is it possible to have ABPeoplePickerNavigationController support only portrait mode?
Solution
Subclass it and override shouldAutorotateToInterfaceOrientation:
// .h file
@interface MMABPeoplePickerPortraitOnlyNavigationController : ABPeoplePickerNavigationController
@end
// .m file
@implementation MMABPeoplePickerPortraitOnlyNavigationController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
@end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow