ios - 为什么弹出嵌套在 UISplitViewController 中的 UINavigationController 的 Controller 会为整个 splitView 设置动画?

标签 ios cocoa-touch ipad uinavigationcontroller uisplitviewcontroller

我有一个适用于 iPad 的应用程序,其中有一个 UISplitViewController(UsersSplitViewController)。在它的左侧(ROOT),我安装了一个 UINavigationController(而右侧用于自定义 View )。
Navigation Controller 具有 2 个 View Controller (2 个不同的 tableViews)的层次结构。只要我将第二个 tableView 插入堆栈(通过在第一个 tableview 中选择一行)一切正常:动画包含从右侧滑入的第二个 tableview(默认)。但是,当我在显示第二个 Controller 时触摸后退按钮时,不是仅对 navigationController 进行动画处理,而是对整个 SplitViewController 进行了动画处理(从屏幕顶部滑入!)。显然,这很丑陋,正是我不想要的……有人能帮忙吗?

这是所有主 Controller 被安装的地方(在 AppDelegate 内):

usersSplitViewController=[[UISplitViewController alloc] init];
usersRootViewController=[[UsersRootViewController alloc] initWithDataSource:self];
usersRootViewController.dataSource=self;
usersRootViewController.appDelegate=self;
usersDetailViewController=[[UsersDetailViewController alloc] init];
usersDetailViewController.dataSource=self;
usersDetailViewController.appDelegate=self;
usersDetailViewController.urvc=usersRootViewController;
usersRootViewController.usersDetailViewController=usersDetailViewController;
usersSplitViewController.viewControllers=[NSArray arrayWithObjects:usersRootViewController,usersDetailViewController,nil];
usersSplitViewController.delegate=usersDetailViewController;
[usersRootViewController release];

这就是在 UsersRootViewController(UINavigationController 的子类)中实例化要显示的 tableViews 的地方:
UITableViewController *userKindTableViewController=[[UITableViewController alloc] init];

//first tableView:
userKind=[[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStyleGrouped];
userKind.dataSource=self;
userKind.delegate=self;

userKindTableViewController.tableView=userKind;
userKindTableViewController.contentSizeForViewInPopover=CGSizeMake(320.0, 200.0);
[self pushViewController:userKindTableViewController animated:NO];
[userKindTableViewController release];

//second tableView:
usersOfKindTableViewController =[[UITableViewController alloc] init];
usersOfKind=[[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
usersOfKind.dataSource=self;
usersOfKind.delegate=self;
usersOfKindTableViewController.tableView=usersOfKind;
usersOfKindTableViewController.contentSizeForViewInPopover=CGSizeMake(320.0, 600.0);

最后,我在第一个的“didSelectRowAtIndexPath”中推送第二个 TableView:
[self pushViewController:usersOfKindTableViewController animated:YES];

谢谢

最佳答案

您需要覆盖 UITableViewController类并实现

shouldAutorotateToInterfaceOrientation: 

方法,使其返回 YES
UIInterfaceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeRight

方向。然后将此类用于您的userKindTableViewControllerusersOfKindTableViewController变量。

关于ios - 为什么弹出嵌套在 UISplitViewController 中的 UINavigationController 的 Controller 会为整个 splitView 设置动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8518398/

相关文章:

ios - cellForRowAtIndex 自定义方法

ios - 将 unsigned int 与 %u 和 %x 一起使用时出现意外值

ios - ios中的数据库大小限制

ipad - 使用 HTTPS 在 iPad Safari 上播放 HTML5 视频

iphone - iOS iPhone : Why does my image rotation skew the image?

iphone - UIImageView 如何跟踪顺时针或逆时针用户运动

cocoa-touch - iOS中如何获取屏幕的宽高?

iphone - 如何让 iPod 音乐在我的应用程序运行时播放?

iphone - 如何查询实际的应用版本字符串?

javascript - 如何在 iPad 中调整/重新缩放网页