之前用的一种方法是在返回页面里面写的
//点击返回操作后
-(void)viewWillDisappear:(BOOL)animated{
UIStoryboard*story=[UIStoryboardstoryboardWithName:@"Main"bundle:[NSBundlemainBundle]];
ScrollerViewController*mainList=[storyinstantiateViewControllerWithIdentifier:@"mainNavigation"];
if([mainListrespondsToSelector:@selector(popoverPresentationController)]) {
mainList.popoverPresentationController.sourceView=self.view;
}
[self.parentViewControllerpresentViewController:mainListanimated:NOcompletion:nil];
}
后来用的方法是在原页面中
-(void)viewWillAppear:(BOOL)animated{
//设置导航栏宽度
CGRectr = [[UIScreenmainScreen]applicationFrame];
self.navigationItem.titleView.frame=CGRectMake(0,0, r.size.width,40);
//设置页面返回时刷新页面
//获取分类
CommenData*c= [[CommenDataalloc]init];
self.category=[cgetCategory];
indexPage=0;
secondPage=0;
//导航更新
[self.scrollnavilayoutSubviews] ;
[self.scrollnavisetSelectedIndex:indexPage];
//页面布局
[selflayoutSubviews];
//设置按钮
[_setButtonaddTarget:selfaction:@selector(goToSet)forControlEvents:UIControlEventTouchUpInside];
}