我有另一个方向问题。但是这个非常棘手。 我的RootViewController是一个正常的NavigationController。方向风景 - >人像不工作
self.window.rootViewController = _naviController;
里面有另一个ViewController,我们称之为VC1。 VC1有一些按钮和标签。它就像文件夹的概述。
如果我按下一个按钮,我来与3视图控制器(页)下一个视图控制器和按钮的另一一束(如文件夹内看图片/内缩略图):
Archiv *archiv = [[Archiv alloc] init];
[self.navigationController pushViewController:archiv animated:YES];
[archiv release];
中的loadView
:
firstPage = [[Page alloc] initViewWithFrame:CGRectMake(0, 0, 768, 960)];
[firstPage setRootViewController:self];
secondPage = [[Page alloc] initViewWithFrame:CGRectMake(0, -960, 768, 960)];
[secondPage setRootViewController:self];
thirdPage = [[Page alloc] initViewWithFrame:CGRectMake(0, 960, 768, 960)];
[thirdPage setRootViewController:self];
如果我现在上的按钮再次点击活动页面推我的第三个视图控制器(带图像缩放,拖动......):
Picture *pic = [[Picture alloc] initWithPicURLString:urlString];
[rootViewController.navigationController pushViewController:pic animated:YES];
[pic release];
使用NavigationController的BackButton,我总是可以回到以前的视图。
一些更多的信息:
- 每个视图控制器支持所有方向
- 每个视图控制器实现
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
与return YES;
- 每ViewControler调用它们的init-梅索德
- 我已经读过Apple's Q&A: Why won't my UIViewController rotate with the device 的
[super init]
现在棘手的问题:
如果我从第2个VC切换到第3 VC,还有来自纵向更改方向为横向,按后退按钮一切工作(shouldAutorotateToInterfaceOrientation
呼吁,帧大小和起源改变...)。 但,如果我周围做它的其他方式,我在风景模式,从第2个VC切换到第3 VC,旋转为纵向,回来第2个VC与后退按钮的状态 - 和controllerBar是在顶部但是shouldAutorotateToInterfaceOrientation
未被称为。
请帮帮我。 $ h @ rky
是的,这项工作也是,但这不能回答问题为什么当我回到纵向方向时视图没有调用。无论如何,如果nodoby告诉我为什么这会在下周发生,我会接受答案。 – Sharky
就像我承诺的接受和upvote,因为决议比我的方式xD更聪明。 $ H @ RKY – Sharky