JoeFryer / JDFPeekaboo

JDFPeekaboo is a simple class that hides the navigation bar when you scroll.
MIT License
292 stars 41 forks source link

iOS 10 issue #20

Open brightsider opened 8 years ago

brightsider commented 8 years ago

For iOS 10 has issue with status bar background - transparent when slowly expand navigation bar via scroll.

JoeFryer commented 7 years ago

Hi @brightsider - you're right. Have you been able to find what's causing this? If you're able to investigate, that would be great. Otherwise I'll get to it at some point...

jlalvarez18 commented 7 years ago

@JoeFryer I pin pointed the area where this is not working correctly on iOS 10. It apparently has to do with setting the titleTextAttributes on the navigation bar with the updated alpha.

The workaround to updated the alpha on the nav bar title is:

if ([self.topView isKindOfClass:[UINavigationBar class]]) {
        UINavigationBar *navigationBar = (UINavigationBar *)self.topView;

        UINavigationItem *topItem = [navigationBar topItem];
        UIView *titleView = [topItem titleView];

        if (titleView != nil) {
            titleView.alpha = alpha;
        } else {
            for (UIView *sub in navigationBar.subviews) {
                if ([sub isKindOfClass:NSClassFromString(@"UINavigationItemView")]) {
                    for (UIView *aSub in sub.subviews) {
                        aSub.alpha = alpha;
                    }
                }
            }
        }
    }

The problem I see is if this will be accepted in the App Store since I'm checking for a private class.

JoeFryer commented 7 years ago

You're right @jlalvarez18 - I found the same thing while investigating. Didn't think of that solution, but yeah, it's not App Store friendly, unfortunately. Any other ideas on a fix?