Repository navigation
[ASRangeController] Improvements for automatic range mode to ensure it is persistent / stable if set for an invisible view. - #1382
Conversation
maicki
commented
Mar 15, 2016
- Only update range mode if visibility changes if the node is not range controlled
- Only change explicitly set range mode if ASRangeController becomes visible
- Return interface state for range controller in ASCollectionView and ASTableView based on if the containing node is range managed
| } | ||
|
|
||
| /** | ||
| * We currently only set interface state on nodes in table/collection views. For other nodes, if they are |
There was a problem hiding this comment.
I'm not sure there is a reason to remove this comment - let's leave it in, at least until it is replaced by something comparable / useful.
|
@appleguy Addressed comments |
| // 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 | ||
| // handles this even if it is the root / directly added to the view hierarchy. | ||
| return (self.window != nil ? ASInterfaceStateVisible : ASInterfaceStateNone); |
There was a problem hiding this comment.
Both here and in collcetion, let's make the first case in the ternary be (ASInterfaceStateVisible | ASInterfaceStateDisplay)
- Only update range mode if visibility changes if the node is not range controlled - Only change explicitly set range mode if ASRangeController becomes visible - Return interface state for range controller in ASCollectionView and ASTableView based on if the containing node is range managed
| @@ -918,13 +918,15 @@ - (CGSize)viewportSizeForRangeController:(ASRangeController *)rangeController | |||
| - (ASInterfaceState)interfaceStateForRangeController:(ASRangeController *)rangeController | |||
There was a problem hiding this comment.
This looks like exactly what we need. In a future diff, let's factor this into the range controller itself, and do something like interfaceStateForDataSource:withWindow: and then deduplicate / share the logic.
| // Trigger updating interfaceState for cells in case ASCollectionView becomes visible or invisible | ||
| [_rangeController visibleNodeIndexPathsDidChangeWithScrollDirection:self.scrollDirection]; | ||
|
|
||
| // Updating the visible node index paths only for range managed nodes. Not range managed nodes will get their |
There was a problem hiding this comment.
comment should say only for NOT range managed collections / tables, e.g. root level ones, need this notification? As range managed ones will get this update through the range controller itself that owns them?
…tateForDisplayNode
…e automatic range mode detection This is necessary to get out of the initial range mode state into the first defined range mode state
[ASRangeController] Improvements for automatic range mode to ensure it is persistent / stable if set for an invisible view.