1
votes

I have an app for iPad with a UISplitViewController in it (UsersSplitViewController). On the left side (ROOT) of it I installed a UINavigationController (while the right side is used for a custom view). The Navigation Controller has a hierarchy of 2 view controllers (2 different tableViews). As long as i push the second tableView on the stack (by selecting a row in the first tableview) everything works just fine: the animation consists in the second tableview sliding in from the right (default). However, when I touch the back button while the second controller is showed, instead of animating just the navigationController, the whole SplitViewController is animated (sliding in from the top of the screen!). Obviously, this is ugly, and just what i don't want... can anyone help?

This is where all the main controllers get instatiated (inside 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];

this is where, inside UsersRootViewController (subclass of UINavigationController), I instantiate the tableViews to be showed:

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);

finally, i Push the second TableView in the first one's "didSelectRowAtIndexPath":

[self pushViewController:usersOfKindTableViewController animated:YES];

Thanks

1

1 Answers

3
votes

You need to overide the UITableViewController class and implement the

shouldAutorotateToInterfaceOrientation: 

method so that it returns YES for

UIInterfaceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeRight

orientations.Then use this class for your userKindTableViewController and usersOfKindTableViewController variables.