mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Refactor nodeDidRelayoutWithSizeChange: -> nodeDidRelayout:sizeChanged:
This commit is contained in:
@@ -15,13 +15,13 @@ typedef NSUInteger ASCellNodeAnimation;
|
||||
@protocol ASCellNodeLayoutDelegate <NSObject>
|
||||
|
||||
/**
|
||||
* Notifies the delegate that the specified cell node has done a relayout
|
||||
* that resulted in a change of `calculatedSize`.
|
||||
* Notifies the delegate that the specified cell node has done a relayout.
|
||||
* The notification is done on main thread.
|
||||
*
|
||||
* @param node A node informing the delegate about the relayout.
|
||||
* @param sizeChanged `YES` if the node's `calculatedSize` changed during the relayout, `NO` otherwise.
|
||||
*/
|
||||
- (void)nodeDidRelayoutWithSizeChange:(ASCellNode *)node;
|
||||
- (void)nodeDidRelayout:(ASCellNode *)node sizeChanged:(BOOL)sizeChanged;
|
||||
@end
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,9 +56,10 @@
|
||||
CGSize oldSize = self.calculatedSize;
|
||||
[super setNeedsLayout];
|
||||
|
||||
if (_layoutDelegate != nil && !CGSizeEqualToSize(oldSize, self.calculatedSize)) {
|
||||
if (_layoutDelegate != nil) {
|
||||
BOOL sizeChanged = !CGSizeEqualToSize(oldSize, self.calculatedSize);
|
||||
ASPerformBlockOnMainThread(^{
|
||||
[_layoutDelegate nodeDidRelayoutWithSizeChange:self];
|
||||
[_layoutDelegate nodeDidRelayout:self sizeChanged:sizeChanged];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -913,11 +913,11 @@ static BOOL _isInterceptedSelector(SEL sel)
|
||||
|
||||
#pragma mark - ASCellNodeDelegate
|
||||
|
||||
- (void)nodeDidRelayoutWithSizeChange:(ASCellNode *)node
|
||||
- (void)nodeDidRelayout:(ASCellNode *)node sizeChanged:(BOOL)sizeChanged
|
||||
{
|
||||
ASDisplayNodeAssertMainThread();
|
||||
|
||||
if (_queuedNodeSizeUpdate) {
|
||||
if (!sizeChanged || _queuedNodeSizeUpdate) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -910,11 +910,11 @@ static BOOL _isInterceptedSelector(SEL sel)
|
||||
|
||||
#pragma mark - ASCellNodeLayoutDelegate
|
||||
|
||||
- (void)nodeDidRelayoutWithSizeChange:(ASCellNode *)node
|
||||
- (void)nodeDidRelayout:(ASCellNode *)node sizeChanged:(BOOL)sizeChanged
|
||||
{
|
||||
ASDisplayNodeAssertMainThread();
|
||||
|
||||
if (_queuedNodeHeightUpdate) {
|
||||
if (!sizeChanged || _queuedNodeHeightUpdate) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user