mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
[ASDisplayNode] Remove node from supernode before adding it as a subview (#2746)
* [ASDisplayNode] Remove node from supernode before adding it as a subview If a node is being added as a subview to a UIVIew, we must make sure to remove it as a subnode of its supernode. * remove from supernode if adding to a layer.
This commit is contained in:
@@ -3876,6 +3876,9 @@ static const char *ASDisplayNodeAssociatedNodeKey = "ASAssociatedNode";
|
||||
if (selfNode) {
|
||||
[selfNode addSubnode:subnode];
|
||||
} else {
|
||||
if (subnode.supernode) {
|
||||
[subnode removeFromSupernode];
|
||||
}
|
||||
[self addSubview:subnode.view];
|
||||
}
|
||||
}
|
||||
@@ -3891,6 +3894,9 @@ static const char *ASDisplayNodeAssociatedNodeKey = "ASAssociatedNode";
|
||||
if (selfNode) {
|
||||
[selfNode addSubnode:subnode];
|
||||
} else {
|
||||
if (subnode.supernode) {
|
||||
[subnode removeFromSupernode];
|
||||
}
|
||||
[self addSublayer:subnode.layer];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user