mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-21 13:50:29 +00:00
ASCellNode notifies its layout delegate during layout transition
This commit is contained in:
parent
e53c0c2d8c
commit
0fe774511c
@ -11,10 +11,12 @@
|
|||||||
#import "ASInternalHelpers.h"
|
#import "ASInternalHelpers.h"
|
||||||
#import <AsyncDisplayKit/_ASDisplayView.h>
|
#import <AsyncDisplayKit/_ASDisplayView.h>
|
||||||
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
|
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
|
||||||
|
#import <AsyncDisplayKit/ASDisplayNode+Beta.h>
|
||||||
#import <AsyncDisplayKit/ASTextNode.h>
|
#import <AsyncDisplayKit/ASTextNode.h>
|
||||||
|
|
||||||
#import <AsyncDisplayKit/ASViewController.h>
|
#import <AsyncDisplayKit/ASViewController.h>
|
||||||
#import <AsyncDisplayKit/ASInsetLayoutSpec.h>
|
#import <AsyncDisplayKit/ASInsetLayoutSpec.h>
|
||||||
|
#import <AsyncDisplayKit/ASLayout.h>
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark ASCellNode
|
#pragma mark ASCellNode
|
||||||
@ -119,10 +121,30 @@
|
|||||||
{
|
{
|
||||||
CGSize oldSize = self.calculatedSize;
|
CGSize oldSize = self.calculatedSize;
|
||||||
[super setNeedsLayout];
|
[super setNeedsLayout];
|
||||||
|
[self didRelayoutFromOldSize:oldSize toNewSize:self.calculatedSize];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (ASLayout *)transitionLayoutWithAnimation:(BOOL)animated
|
||||||
|
{
|
||||||
|
CGSize oldSize = self.calculatedSize;
|
||||||
|
ASLayout *layout = [super transitionLayoutWithAnimation:animated];
|
||||||
|
[self didRelayoutFromOldSize:oldSize toNewSize:layout.size];
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (ASLayout *)transitionLayoutWithSizeRange:(ASSizeRange)constrainedSize animated:(BOOL)animated
|
||||||
|
{
|
||||||
|
CGSize oldSize = self.calculatedSize;
|
||||||
|
ASLayout *layout = [super transitionLayoutWithSizeRange:constrainedSize animated:animated];
|
||||||
|
[self didRelayoutFromOldSize:oldSize toNewSize:layout.size];
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)didRelayoutFromOldSize:(CGSize)oldSize toNewSize:(CGSize)newSize
|
||||||
|
{
|
||||||
if (_layoutDelegate != nil && self.isNodeLoaded) {
|
if (_layoutDelegate != nil && self.isNodeLoaded) {
|
||||||
ASPerformBlockOnMainThread(^{
|
ASPerformBlockOnMainThread(^{
|
||||||
BOOL sizeChanged = !CGSizeEqualToSize(oldSize, self.calculatedSize);
|
BOOL sizeChanged = !CGSizeEqualToSize(oldSize, newSize);
|
||||||
[_layoutDelegate nodeDidRelayout:self sizeChanged:sizeChanged];
|
[_layoutDelegate nodeDidRelayout:self sizeChanged:sizeChanged];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user