Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_setElementsAlpha didn't change backItem arrow alpha #32

Open
ghost opened this issue May 17, 2016 · 1 comment
Open

_setElementsAlpha didn't change backItem arrow alpha #32

ghost opened this issue May 17, 2016 · 1 comment

Comments

@ghost
Copy link

ghost commented May 17, 2016

If the navigation bar have a back button item it didn't change alpha value and is always displayed in statusbar

@ghost
Copy link
Author

ghost commented May 17, 2016

An easy way to solve it and simplify the method:

From:
`- (void)lt_setElementsAlpha:(CGFloat)alpha
{
[[self valueForKey:@"_leftViews"] enumerateObjectsUsingBlock:^(UIView *view, NSUInteger i, BOOL *stop) {
view.alpha = alpha;
}];

[[self valueForKey:@"_rightViews"] enumerateObjectsUsingBlock:^(UIView *view, NSUInteger i, BOOL *stop) {
    view.alpha = alpha;
}];

UIView *titleView = [self valueForKey:@"_titleView"];
titleView.alpha = alpha;

// when viewController first load, the titleView maybe nil
[[self subviews] enumerateObjectsUsingBlock:^(UIView *obj, NSUInteger idx, BOOL *stop) {
if ([obj isKindOfClass:NSClassFromString(@"UINavigationItemView")]) {
obj.alpha = alpha;
*stop = YES;
}
}];
}`

To:
`- (void)lt_setElementsAlpha:(CGFloat)alpha
{
self.tintColor = [self.tintColor colorWithAlphaComponent:alpha];

UIView *titleView = [self valueForKey:@"_titleView"];
titleView.alpha = alpha;

// when viewController first load, the titleView maybe nil
[[self subviews] enumerateObjectsUsingBlock:^(UIView *obj, NSUInteger idx, BOOL *stop) {
if ([obj isKindOfClass:NSClassFromString(@"UINavigationItemView")]) {
obj.alpha = alpha;
*stop = YES;
}
}];
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants