Add method for checking date visibility. Improve scrolling method to consider if header is pinned. #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I wanted to check if a date is already displayed, so I know whether to scroll to it, or for example to hide the calendar if it is already in view.
I also wanted the scrolling to actually show the date itself, not just the month. So I made both my new method and the scrolling method check for pinning, and go to the exact row or the section based on whether header pinning is turned on.
Suggestions for refactoring out the duplicate code for checking pinsHeaderToTop? It bugs me but so does adding something like pinnedIndexPathForRowAtDate:. Could also do indexPathForRowAtDate:IgnorePinning: where the second argument is a BOOL on whether to use pinning or not. Or maybe is whether to return the header row for the month instead of the exact row. That doesn't seem like a great solution either.