mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Update for visibility monitoring
This commit is contained in:
@@ -10,6 +10,6 @@
|
|||||||
|
|
||||||
@interface ASCellNode (Internal)
|
@interface ASCellNode (Internal)
|
||||||
|
|
||||||
@property (nonatomic, assign) BOOL shouldObserveVisibility;
|
@property (nonatomic, assign) BOOL shouldMonitorScrollViewDidScroll;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
_selectionStyle = UITableViewCellSelectionStyleDefault;
|
_selectionStyle = UITableViewCellSelectionStyleDefault;
|
||||||
self.clipsToBounds = YES;
|
self.clipsToBounds = YES;
|
||||||
if ([self.layoutDelegate respondsToSelector:@selector(visibleNodeDidScroll:inScrollView:withCellFrame:)]) {
|
if ([self.layoutDelegate respondsToSelector:@selector(visibleNodeDidScroll:inScrollView:withCellFrame:)]) {
|
||||||
self.shouldObserveVisibility= YES;
|
self.shouldMonitorScrollViewDidScroll = YES;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ([self.layoutDelegate respondsToSelector:@selector(visibleNodeDidScroll:inScrollView:withCellFrame:)]) {
|
if ([self.layoutDelegate respondsToSelector:@selector(visibleNodeDidScroll:inScrollView:withCellFrame:)]) {
|
||||||
self.shouldObserveVisibility = YES;
|
self.shouldMonitorScrollViewDidScroll = YES;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@
|
|||||||
|
|
||||||
- (void)_visibleNodeDidScroll:(UIScrollView *)scrollView withCellFrame:(CGRect)cellFrame
|
- (void)_visibleNodeDidScroll:(UIScrollView *)scrollView withCellFrame:(CGRect)cellFrame
|
||||||
{
|
{
|
||||||
if (self.shouldObserveVisibility) {
|
if (self.shouldMonitorScrollViewDidScroll) {
|
||||||
[self.layoutDelegate visibleNodeDidScroll:self inScrollView:scrollView withCellFrame:cellFrame];
|
[self.layoutDelegate visibleNodeDidScroll:self inScrollView:scrollView withCellFrame:cellFrame];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -673,8 +673,10 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
|
|||||||
|
|
||||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
|
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
|
||||||
{
|
{
|
||||||
for (ASCellNode *node in _cellsForVisibilityUpdates) {
|
for (_ASCollectionViewCell *collectionCell in _cellsForVisibilityUpdates) {
|
||||||
if (node.shouldObserveVisibility) {
|
ASCellNode *node = [collectionCell node];
|
||||||
|
if (node.shouldMonitorScrollViewDidScroll) {
|
||||||
|
NSLog(@"Calling _visibleNodeDidScroll");
|
||||||
[node _visibleNodeDidScroll:scrollView withCellFrame: node.frame];
|
[node _visibleNodeDidScroll:scrollView withCellFrame: node.frame];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user