Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix for #367.
Motivation
After investigating this and testing on iOS's 8-12 I could not observe that recursive subview actually does anything(except causing flickering on iOS 11 and 12 :).
Bar button items(including those with custom views) are handled by these:
Title and title view handled here:
Any other "tintable" stuff handled here
It seems that all cases are covered already without the need to traverse navigation bar view hierarchy updating alpha for each of them(which also has it's problems).
Issue with recursive alpha
As the documentation for
UIView.alpha
statesWhich results in alpha value of a view being multiplied by alpha of its superview(and superview of superview and so on).
In this illustration you can see what I'm trying to describe:
The first square consists of a white view with alpha
0.5
and a black subview with alpha0.5
. Square two and three are just for comparison - the first one is a black view with alpha 0.25, second one - 0.5.This shows that recursively applying alpha produces result different from desired - in an attempt to set everything to
0.5
- the result ended up looking as if it has alpha of value0.25
. And this is in controlled environment - view hierarchy depth is limited to 2 in this example, this should be more pronounced when nesting is deeper, the alpha of the deepest view should be desired_alpha^depth.Here's playground with this setup:
RecursiveAlphaPlayground.playground.zip