mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-21 13:50:29 +00:00
Improve way to detect interface state of ASCollectionView and ASTableView
This commit is contained in:
parent
19232ac493
commit
3b4e8d732c
@ -920,14 +920,14 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
|
|||||||
ASCollectionNode *collectionNode = self.collectionNode;
|
ASCollectionNode *collectionNode = self.collectionNode;
|
||||||
if (collectionNode && [collectionNode supportsRangeManagedInterfaceState]) {
|
if (collectionNode && [collectionNode supportsRangeManagedInterfaceState]) {
|
||||||
// Only use the interfaceState of nodes that are range managed
|
// Only use the interfaceState of nodes that are range managed
|
||||||
return collectionNode.interfaceState;
|
ASInterfaceState interfaceState = collectionNode.interfaceState;
|
||||||
|
return (self.window == nil ? (interfaceState &= (~ASInterfaceStateVisible)) : interfaceState);
|
||||||
} else {
|
} else {
|
||||||
// For not range managed nodes or until we can always create an associated ASCollectionNode
|
// For not range managed nodes or until we can always create an associated ASCollectionNode
|
||||||
// without a retain cycle, we might be on our own to try to guess if we're visible. The node normally
|
// without a retain cycle, we might be on our own to try to guess if we're visible. The node normally
|
||||||
// handles this even if it is the root / directly added to the view hierarchy.
|
// handles this even if it is the root / directly added to the view hierarchy.
|
||||||
return (self.window != nil ? ASInterfaceStateVisible : ASInterfaceStateNone);
|
return (self.window == nil ? ASInterfaceStateNone : (ASInterfaceStateVisible | ASInterfaceStateDisplay));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)rangeController:(ASRangeController *)rangeController nodesAtIndexPaths:(NSArray *)indexPaths
|
- (NSArray *)rangeController:(ASRangeController *)rangeController nodesAtIndexPaths:(NSArray *)indexPaths
|
||||||
|
|||||||
@ -797,12 +797,13 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
|
|||||||
ASTableNode *tableNode = self.tableNode;
|
ASTableNode *tableNode = self.tableNode;
|
||||||
if (tableNode && [tableNode supportsRangeManagedInterfaceState]) {
|
if (tableNode && [tableNode supportsRangeManagedInterfaceState]) {
|
||||||
// Only use the interfaceState of nodes that are range managed
|
// Only use the interfaceState of nodes that are range managed
|
||||||
return self.tableNode.interfaceState;
|
ASInterfaceState interfaceState = self.tableNode.interfaceState;
|
||||||
|
return (self.window == nil ? (interfaceState &= (~ASInterfaceStateVisible)) : interfaceState);
|
||||||
} else {
|
} else {
|
||||||
// For not range managed nodes or until we can always create an associated ASTableNode
|
// For not range managed nodes or until we can always create an associated ASTableNode
|
||||||
// without a retain cycle, we might be on our own to try to guess if we're visible. The node normally
|
// without a retain cycle, we might be on our own to try to guess if we're visible. The node normally
|
||||||
// handles this even if it is the root / directly added to the view hierarchy.
|
// handles this even if it is the root / directly added to the view hierarchy.
|
||||||
return (self.window != nil ? ASInterfaceStateVisible : ASInterfaceStateNone);
|
return (self.window == nil ? ASInterfaceStateNone : (ASInterfaceStateVisible | ASInterfaceStateDisplay));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user