之前用的一種方法是在返回頁面里面寫的
//點擊返回操作后
-(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{
//設(shè)置導航欄寬度
CGRectr = [[UIScreenmainScreen]applicationFrame];
self.navigationItem.titleView.frame=CGRectMake(0,0, r.size.width,40);
//設(shè)置頁面返回時刷新頁面
//獲取分類
CommenData*c= [[CommenDataalloc]init];
self.category=[cgetCategory];
indexPage=0;
secondPage=0;
//導航更新
[self.scrollnavilayoutSubviews] ;
[self.scrollnavisetSelectedIndex:indexPage];
//頁面布局
[selflayoutSubviews];
//設(shè)置按鈕
[_setButtonaddTarget:selfaction:@selector(goToSet)forControlEvents:UIControlEventTouchUpInside];
}