0
votes

I am using a ABPersonViewController and ABNewPersonViewController class by pushview controller.

 ABPersonViewController *pvc = [[ABPersonViewController alloc] init];
 [pvc setPersonViewDelegate:self];
 [[self navigationController] pushViewController:pvc animated:YES];

In ABPersonViewController and ABNewPersonViewController page it is displaying in portrait mode. But when I rotate my iPhone then it is perfectly rotating in landscape mode. But I want to stop this rotation. If I rotate my iPhone in landscape mode it's view should be in portrait mode.

1

1 Answers

1
votes

The solution for your problem is quite simple: just subclass UINavigationController like this:

@interface UINonRotatingNavigationController : UINavigationController {
}
@end

in your .h file, and in your .m file type:

@implementation UINonRotatingNavigationController {

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

@end

Use it as your main navigation controller for the person picker - this should block it from rotating.

Hope this was helpful, Paul