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?
La solution
Subclass it and override shouldAutorotateToInterfaceOrientation:
// .h file
@interface MMABPeoplePickerPortraitOnlyNavigationController : ABPeoplePickerNavigationController
@end
// .m file
@implementation MMABPeoplePickerPortraitOnlyNavigationController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
@end
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow