2
我的应用只使用肖像模式。但ABPeoplePickerNavigationController支持横向。是否有可能让ABPeoplePickerNavigationController只支持肖像模式?Objective-C - 在ABPeoplePickerNavigationController中锁定旋转
我的应用只使用肖像模式。但ABPeoplePickerNavigationController支持横向。是否有可能让ABPeoplePickerNavigationController只支持肖像模式?Objective-C - 在ABPeoplePickerNavigationController中锁定旋转
继承它,并覆盖shouldAutorotateToInterfaceOrientation:
// .h file
@interface MMABPeoplePickerPortraitOnlyNavigationController : ABPeoplePickerNavigationController
@end
// .m file
@implementation MMABPeoplePickerPortraitOnlyNavigationController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
@end
你不应该使用'AB'作为类的前缀,这是保留给通讯录框架类。 – omz 2012-07-20 18:05:12
@omz编辑的代码。 – Guillaume 2012-07-20 20:26:22
或'interfaceOrientation == UIInterfaceOrientationPortrait'。 'UIInterfaceOrientationIsPortrait()'对于PortraitUpsideDown也是如此,这可能不是预期的。 – 2012-07-20 23:04:36