所以我有一个视图,当界面方向更改为横向时,我以模态方式呈现 . 但是,当方向返回到纵向并且模态视图自行消失时,初始视图中的工作视图仍保持横向(此表视图必须仅以纵向方向)
这是代码:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ((interfaceOrientation == UIInterfaceOrientationPortrait) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight) );
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if ((toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)) {
[self performSegueWithIdentifier:@"showCatChart" sender:self];
}
if (toInterfaceOrientation == UIInterfaceOrientationPortrait) {
[self refreshTableView];
}
}
我试图刷新tableview,但这并没有让它再次成像...这可能是从视图层次结构... NavigationController-> tableView(只有肖像) - > tableview-> landscapeViewModalController
2 回答
使用iOS 6,您需要实现以下功能:
在AppDelegate中,您需要更改以下内容:
至
另外,如果要支持以前版本的iOS,请保留当前代码 .
在appdelegate中使用以下内容 .
仅此一项就可以解决您的定位问题 .