telly / TLYShyNavBar

Unlike all those arrogant UINavigationBar, this one is shy and humble! Easily create auto-scrolling navigation bars!
MIT License
3.73k stars 427 forks source link

Issue related to child view controllers #170

Open bernikovich opened 7 years ago

bernikovich commented 7 years ago

Hello.

I have issue with custom controllers hierarchy. My VCs stack looks like this: VCs stack

Code in blue VC:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    static UIScrollView *scrollView;
    if (!scrollView) {
        for (UIView *view in self.view.subviews) {
            if ([view isKindOfClass:[UIScrollView class]]) {
                scrollView = (UIScrollView *)view;
                break;
            }
        }
        scrollView.contentSize = CGSizeMake(CGRectGetWidth(scrollView.frame), 2000);
        UIView *content = [UIView new];
        content.backgroundColor = [UIColor redColor];
        content.frame = CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height);
        [scrollView addSubview:content];
    }

    if (!self.isShyNavBarManagerPresent) {
        TLYShyNavBarManager *scrollManager = [TLYShyNavBarManager new];
        scrollManager.scrollView = scrollView;
        [self setShyNavBarManager:scrollManager viewController:self.parentViewController];
    }
}

I have already tried (with no luck):

You can check sample project, try to push view controller (press bar button item) and than go back: https://github.com/bernikowich/TLYShyNavBarChildControllerIssue