我将SLPagingView(https://github.com/StefanLage/SLPagingView/)开源库用于基于分页视图的应用程序,如Twitter或Tinder。 从某个页面我打开一个详细视图。当我回来时,分页视图的布局被打破了。
DetailViewController.m
- (void)backButtonPressed {
[self dismissViewControllerAnimated:YES completion:nil];
}
事实上,我注意到应用程序的层次结构在DetailView出现之前就被打破了。
SomePageViewController.m
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Perform segue to detailView
[self performSegueWithIdentifier:@"actionDetail" sender:nil];
/* Does not work with a modal view controller either
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main"bundle:nil];
DetailViewController *detailViewController =
(DetailViewController *)
[storyboard instantiateViewControllerWithIdentifier:@"detailcontroller_id"];
[self pushViewController:detailViewController animated:YES];*/
}
我收到Presenting view controllers on detached view controllers is discouraged
警告。我尝试将self
替换为self.navigationController
或self.parentViewController.navigationController
,但两者都不起作用。
是否有人使用此库可以解决此问题或知道解决方案?
答案 0 :(得分:0)
固定。
我修改了SLPagingView库。在[self addChildViewController:ctr]
,initWithNavBarControllers:
和其他生命周期方法中添加initWithNavBarItem:
。
检查差异:https://www.diffchecker.com/cnlvslym