2012-02-02 33 views

回答

2

继承它,并覆盖shouldAutorotateToInterfaceOrientation:

// .h file 
@interface MMABPeoplePickerPortraitOnlyNavigationController : ABPeoplePickerNavigationController 
@end 

// .m file 
@implementation MMABPeoplePickerPortraitOnlyNavigationController 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    return UIInterfaceOrientationIsPortrait(interfaceOrientation); 
} 

@end 
+0

你不应该使用'AB'作为类的前缀,这是保留给通讯录框架类。 – omz 2012-07-20 18:05:12

+0

@omz编辑的代码。 – Guillaume 2012-07-20 20:26:22

+0

或'interfaceOrientation == UIInterfaceOrientationPortrait'。 'UIInterfaceOrientationIsPortrait()'对于PortraitUpsideDown也是如此,这可能不是预期的。 – 2012-07-20 23:04:36