解雇视图时,分页视图层次结构被破坏

时间:2015-07-26 22:18:58

标签: ios objective-c navigation modal-dialog scroll-paging

我将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.navigationControllerself.parentViewController.navigationController,但两者都不起作用。

是否有人使用此库可以解决此问题或知道解决方案?

1 个答案:

答案 0 :(得分:0)

固定。 我修改了SLPagingView库。在[self addChildViewController:ctr]initWithNavBarControllers:和其他生命周期方法中添加initWithNavBarItem:。 检查差异:https://www.diffchecker.com/cnlvslym