I use the SLPagingView (https://github.com/StefanLage/SLPagingView/) open source library for a paging view based app like Twitter or Tinder. From some page I open a detail view. When I come back the layout of the paging views is broken.
DetailViewController.m
- (void)backButtonPressed {
[self dismissViewControllerAnimated:YES completion:nil];
}
In fact I noticed that the hierarchy of the app is broken just before the DetailView appears.
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];*/
}
I got the Presenting view controllers on detached view controllers is discouraged
warning. I tried to replace self
by self.navigationController
or self.parentViewController.navigationController
but both don't work.
Does anyone using this library fix this issue or know a solution?
Fixed.
I modified the SLPagingView library. Add [self addChildViewController:ctr]
in initWithNavBarControllers:
, initWithNavBarItem:
and other life cycle methods.
Check the differences: https://www.diffchecker.com/cnlvslym