我有一个拆分视图控制器,它包含一个选项卡控制器,在每个选项卡项中都包含一个表视图 - 所有这些都在“主控侧”。表格视图给出了用户可以从中选择的项目列表,以便控制“详细信息”侧显示的内容。
我试图在用户做出选择后将主表视图移出屏幕 - 而不是用户需要点击屏幕来关闭主表视图。
我正在使用以下代码。由于代码注释表明它留下了半透明的“阴影”来代替主侧表视图。我还需要做些什么才能将主侧表视图完全移出屏幕。
- (void)hideSidebarNavPanel
{
/* This almost works - in that it moves the table view off the screen but leaves a "shadow" in its place.
This occurs whether we modify the frame for the tabBarView or the masterTableView or the masterView - or for all 3.
It seems that there is something else sitting below both of these that also needs to have its frame modified.
The question is what?
*/
UIView *masterView = self.view;
CGRect masterViewFrame = masterView.frame;
masterViewFrame.origin.x -= masterViewFrame.size.width;
NSArray *controllers = self.splitViewController.viewControllers;
UITabBarController *tabBarController = [controllers objectAtIndex:0];
UIView *tabBarView = tabBarController.view;
CGRect tabBarFrame = tabBarView.frame;
tabBarFrame.origin.x -= tabBarFrame.size.width;
// UIViewController *masterNavigationController = [tabBarController.viewControllers objectAtIndex:0];
// UIView *masterTableView = masterNavigationController.view;
// CGRect masterTableViewFrame = masterTableView.frame;
// masterTableViewFrame.origin.x -= masterTableViewFrame.size.width;
[UIView beginAnimations:@"showView" context:NULL];
masterView.frame = masterViewFrame;
tabBarView.frame = tabBarFrame;
//masterTableView.frame = masterTableViewFrame;
[UIView commitAnimations];
}