我是Xcode的新手,过去两天我一直试图解决这个问题。
我有一个菜单(tableView),它打开一个子菜单(tableview)。选择子菜单中的项目将打开该特定项目的contentView。
第一个选择正常,例如:
客户> Customer1>客户1详细信息导航>客户1详细信息
现在,如果我在第一个菜单中更改选择,它将显示Produc1 Details视图的navigationController,但显示Customer1 Details视图的快照,例如:
产品>产品1>产品1详情导航>客户1详细信息
Bellow是用于浏览菜单的代码:
MAINMENU
if( [string isEqualToString:@"Customers"] ){
[self.contentNavigationController.view removeFromSuperview];
_subContentView.hidden = YES;
_subMenuView.hidden = NO;
CustomersController *cc = (CustomersController*)((UINavigationController*)[self.storyboard instantiateViewControllerWithIdentifier:@"CustomersNav"]).viewControllers[0];
cc.selectorDelegate = self;
cc.isSelector = NO;
[self.subMenuNavigationController pushViewController:cc animated:YES];
[self.subMenuNavigationController popToViewController:cc animated:NO];
NSLog(@"%d",self.subMenuNavigationController.viewControllers.count);
_contentView.contentSize = CGSizeMake(540, 748);
}
SUBMENU
-(void)customersChangedSelectedCustomerTo:(NSDictionary*)dictionary{
_subContentView.hidden=YES;
_contentView.contentSize = CGSizeMake(860, 748);
CustomerDetailsController *cdc = (CustomerDetailsController*)((UINavigationController*)[self.storyboard instantiateViewControllerWithIdentifier:@"CustomerDetailsNav"]).viewControllers[0];
[cdc setCustomerID:[dictionary[@"CustomerID"] intValue]];
//try
[self.subContentNavigationController popViewControllerAnimated:NO];
//try
[self.subContentNavigationController pushViewController:cdc animated:YES];
[self.subContentNavigationController popToViewController:cdc animated:NO];
[self.subContentNavigationController setViewControllers:@[ cdc ]];
_subContentView.hidden = NO;
}
以下是显示正在发生的事情的2个屏幕截图。绿色和红色的矩形用于向您展示菜单的流程。
我会张贴图片,但我没有足够的代表。