view刷新

之前用的一种方法是在返回页面里面写的

//点击返回操作后

-(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];

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容