mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
-[UIView addSubnode:], -[CALayer addSubnode:].
Bring back this convenience API -- it disappeared somewhere along the line while we were building Paper. This is totally trivial, but conveniently won't break if you layer-back a leaf node. Closes #278.
This commit is contained in:
@@ -1751,3 +1751,26 @@ static const char *ASDisplayNodeAssociatedNodeKey = "ASAssociatedNode";
|
||||
@implementation CALayer (ASDisplayNodeInternal)
|
||||
@dynamic asyncdisplaykit_node;
|
||||
@end
|
||||
|
||||
|
||||
@implementation UIView (AsyncDisplayKit)
|
||||
|
||||
- (void)addSubnode:(ASDisplayNode *)node
|
||||
{
|
||||
if (node.layerBacked) {
|
||||
[self.layer addSublayer:node.layer];
|
||||
} else {
|
||||
[self addSubview:node.view];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CALayer (AsyncDisplayKit)
|
||||
|
||||
- (void)addSubnode:(ASDisplayNode *)node
|
||||
{
|
||||
[self addSublayer:node.layer];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user