3
我打电话了一个UINavigationController,通常允许它使用任何主要方向:回转型的UINavigationController +错误的UITableViewController以横向
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
// return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
BOOL isAllowed;
if ([allowedOrientations isEqualToString:@"portrait"]) {
isAllowed = (interfaceOrientation == UIInterfaceOrientationPortrait ||
interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
} else if ([allowedOrientations isEqualToString:@"landscape"]) {
isAllowed = (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
} else {
isAllowed = YES;
}
return isAllowed;
}
从那里,我叫一个UITableViewController:
myTable = [[SimpleDocViewerTable alloc] initWithFrame:thisFrame];
self = [super initWithRootViewController:myTable];
其中:
@interface SimpleDocViewerTable : UITableViewController {
表视图控制器和navi大多数看似控制器看起来都是正确集成的当我把一个新的页面到导航控制器,它正确地滚动从右到左,不管我用什么方向:
SimpleDocPageVC *thisVC = [[SimpleDocPageVC alloc] initWithView:docView];
thisVC.title = [[[tableEntries objectAtIndex:indexPath.section]
objectAtIndex:indexPath.row] objectForKey:@"title"];
[self.navigationController pushViewController:thisVC animated:YES];
然而,当我退出,推高页,如果iPhone在横向模式,它从下到上滚动,而不是从右向左滚动。
该popViewController神奇地照顾在产生的自动“后退”按钮,所以它应该做正确的事情......但没有。
我有同样的问题,你的评论帮助我解决它!谢谢 – daveoncode
我只是想确认塞尔吉奥的回答。有同样的问题,并检查shouldAutorotateToInterfaceOrientation方法后,其中一个控制器实际上没有shouldAutorotateToInterfaceOrientation方法。 –
你没救过我一次......但已经两次了! –