的旋转iPhone中横向模式下的ABNewPersonViewC

的旋转iPhone中横向模式下的ABNewPersonViewC

本文介绍了如何停止ABPersonViewController&的旋转iPhone中横向模式下的ABNewPersonViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过pushview控制器使用ABPersonViewControllerABNewPersonViewController类.

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];

ABPersonViewControllerABNewPersonViewController页面中,它以纵向模式显示.但是,当我旋转iPhone时,它在横向模式下会完美旋转.但我想停止这种轮换.如果我以横向模式旋转iPhone,则其视图应为纵向模式.

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.

推荐答案

您的问题的解决方案非常简单:只需将UINavigationController子类化为这样:

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

@interface UINonRotatingNavigationController : UINavigationController {
}
@end

.h文件和.m文件类型:

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

这篇关于如何停止ABPersonViewController&的旋转iPhone中横向模式下的ABNewPersonViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 21:32