Open pscarnegie opened 7 years ago
There's no way (so far) to limit the number of weeks that are displayed, but we've had a similar use case where the app is mostly usable for a given time period, and what we did was this:
selectedDate
to the start date of that date range (at least if it's after "today")weekSelector: numberColorForDate:
delegate and return grey for dates outside that time range.That way there's at least a visual indication whether you're within the date range that's covered and you don't need to scroll manually to find the start of that range.
Well that's unfortunate ... perhaps it could be something that you'll look at adding in a future update.
I have been digging though your code and had a thought I'd like to run past you if you've got a minute. I noticed in your "ASWeekSelectorView.m" file that if I comment out the "if (offset.x >= width * 2 || offset.x <= 0)" statement within your "scrollViewDidScroll" method, it sort of works like I'm intending ... what happens is the calendar will only slide between the 3 different week frames and not even create the other weeks. When it gets to the end of the available weeks, it just bounces back. Perfect for what I've been trying to do.
What I'm wondering is if there was a way of setting up a parent conditional to that statement where if the earliest week (week0) displayed is greater than or equal to a new NSDate start week variable, and the last week (week2) displayed is less than or equal to a new NSDate end week variable, then slide accordingly between them. So, essentially I want to keep making that -7 or +7 offset until we get to a week that is beyond either of the two bookends. That way it wouldn't even draw the weeks outside of those parameters and just bounce.
Unfortunately I haven't get that pinned down yet, so any other suggestions would be greatly appreciated. Thanks again for any insights you have the time to share.
-----Original Message----- From: "Adrian Schoenig" notifications@github.com Sent: Thursday, January 5, 2017 7:21pm To: "nighthawk/ASWeekSelectorView" ASWeekSelectorView@noreply.github.com Cc: "pscarnegie" mailme@scarnegie.net, "Author" author@noreply.github.com Subject: Re: [nighthawk/ASWeekSelectorView] Set a fixed number of weeks (#6)
There's no way (so far) to limit the number of weeks that are displayed, but we've had a similar use case where the app is mostly usable for a given time period, and what we did was this: Initialise selectedDate to the start date of that date range (at least if it's after "today") Implement the weekSelector: numberColorForDate: delegate and return grey for dates outside that time range. That way there's at least a visual indication whether you're within the date range that's covered and you don't need to scroll manually to find the start of that range. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub , or mute the thread .
Is there a way where you can set a fixed number of weeks available to display. For example, if I only want to be able to display the four weeks of February, and the current date is November, I'd have to scroll all the way back to February when launched. Can I set a start and stop date for display updates?