Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/99.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 不同方向的导航控制器_Objective C_Ios_Uinavigationcontroller - Fatal编程技术网

Objective c 不同方向的导航控制器

Objective c 不同方向的导航控制器,objective-c,ios,uinavigationcontroller,Objective C,Ios,Uinavigationcontroller,我想创建一个UINavigationController,包括一个主视图控制器和一个局部视图控制器 主视图控制器可以在纵向和LandscapeRight中旋转,而局部视图控制器只能在LandscapeRight中查看(局部显示电影) 设置此项的最佳方法是什么?我建议添加以下代码行 在主视图控制器上: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

我想创建一个UINavigationController,包括一个主视图控制器和一个局部视图控制器

主视图控制器可以在纵向和LandscapeRight中旋转,而局部视图控制器只能在LandscapeRight中查看(局部显示电影)


设置此项的最佳方法是什么?

我建议添加以下代码行

在主视图控制器上:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

     return interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeRight;
}
在详细视图控制器上

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

     return interfaceOrientation == UIInterfaceOrientationLandscapeRight;
}
在iOS 7中,这个方法

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
已被弃用。但是,您可以使用

- (BOOL)shouldAutorotate
只需返回是/否

然后,您可以告诉viewcontroller中哪些方向是可接受的

- (NSUInteger)supportedInterfaceOrientations

天哪,要是这么简单就好了。