This repository was archived by the owner on Feb 2, 2023. It is now read-only.
[ASDisplayNode] Automatically find and hook up node hierarchies, even when -addSubview: is used directly. #961
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.
Improve UIView & CALayer handling of -addSubnode:, and ensure node hierarchies are hooked up even when addSubview: is used directly.
@1nput0utput, could you please test this? I have already done so with your app and am pretty sure it is the complete fix. This one was a hell of a hard time to develop. I tried all combinations of addSubview / addSubnode for both the ingoing and outgoing of the animation (including mismatched ones - going wild over here!)
I did quite a bit of debugging for the flash, but sadly and strangely have not been able to locate it yet. The contents of the image node is NOT being cleared and the image is NOT re-decoding. So I think the actual cause is likely that the view controllers are not swapped out in the same runloop or something like that.
Just so you know, the main reason this was so hard is that at the end of the animation you were adding the node back to the KittenNode while the hierarchy that owned the KittenNode (ASTableView etc) itself was not onscreen - its window was considered nil - and so this introduced some trickiness, but I think that is now handled.
I want to make sure the flicker is fixed, but I'm running low on time to debug that specifically. Could you please take a look at a technique such as marking the other view .hidden or .alpha = 0.0, instead of removing it from the window completely, or at least verify that it is added and in the hierarchy behind the view that is being faded out before the transition starts?