DDCalendarView
DDCalendarView copied to clipboard
scrollRectToVisible not working current date and time
I just want to scroll view need to show current time onwards event.Later user can scroll. So suppose if any event starting in 5 Pm then scroll view should load from 4 PM, scrolling again can see all event.
the calendar view has - (void)scrollDateToVisible:(NSDate* _Nonnull)date animated:(BOOL)animated;
does that not work?
Its not working. I should load view from as per current time On 25-May-2016 5:08 PM, "Dominik Pich" [email protected] wrote:
the calendar view has - (void)scrollDateToVisible:(NSDate* _Nonnull)date animated:(BOOL)animated;
does that not work?
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/Daij-Djan/DDCalendarView/issues/6#issuecomment-221547858
can you show me a sample example? the code you have... it works fine on my end
updated my control with week view, more l&f and performance - awaiting bugreports before pushing it out via #cocoapods
the not scrolling seems to be random but I can sometimes reproduce it
Hey, could you please, let me know required to change to fix the issue, i have done a lot of changes in last version, which is not possible to revert it back. If you tell me changes which I can implement make previous version work?
Hi I'm having the same issue here, Once I'm on CalendarView:focussedOnDay, I check if I have an event for that day, if I have an event I'm trying to show the first one scrolling to it, if not, I'm trying to scroll to 7:00am. Sometimes it works, sometimes it does not. My current timezone is UTC-3.
I'm checking the DDCAlendarSingledayView pointForDate, but I cannot understand the logic there. I will keep you posted if I found something.
Thank you so much!
It seems there is something related with these lines in [DDCalendarSingleDayView pointToDate:]
//we only encompass prev and next day.. we dont care about 2 or more days
if(compsOfBegin.day > compsNow.day) beginInHoursSinceMidnightToday += 24;
else if(compsOfBegin.day < compsNow.day) beginInHoursSinceMidnightToday -= 24;
I've commented out this portion of code, and it seems to work, maybe I'm missing something, or I broke somethign else.
Just to show the as events start from time I have modified it like,
- (void)showPreviewForDate:( nullable NSDate *)startDate { dispatch_async(dispatch_get_main_queue(), ^{ [self.centerCal setContentOffset:CGPointMake(0,[self getDynamicYAxisFor:startDate]) animated:NO]; });
}
#pragma mark - Calculate Y Axis for
-
(int)getDynamicYAxisFor:(NSDate *)date{
NSCalendar *gregorianCal = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; NSDateComponents *dateComps = [gregorianCal components: (NSCalendarUnitHour | NSCalendarUnitMinute) fromDate: date]; int mins =(int)[dateComps minute]; int hr =(int)[dateComps hour]; int yForCurrentTime = (((hr)60) + mins).8333 +14; return yForCurrentTime-50; }
These two method seems failing for me
- (void)scrollDateToVisible:(NSDate* _Nonnull)date animated:(BOOL)animated;
- (void)showPreviewForDate:(nullable NSDate *)startDate ; so I got another way as above explained.
But still, my solutions does not work in the exceptional scenario. I have to work on this.
Please, add current time in the project and when you view loads it must scroll to your current time. you component is awesome but needs some fixes.
Let me know if you have any question.