Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当进入下一页中断后,currentPage 设置不正确。when go to next page interrupt,currentPage not return right #1428

Open
mpmpmp911 opened this issue Apr 9, 2024 · 0 comments

Comments

@mpmpmp911
Copy link

mpmpmp911 commented Apr 9, 2024

类似 demo Prev-Next-Buttons 。
步骤:
step1. 点击nextClicked后,马上按住当前页面,不让日历进入下一个月,
step2. 松手,返回当前页面。

观察currentPage 的值与当前页面不一致。
currentPage已经为 下一个月的日期。

step3.再点击下一页 会连续跳两页。

希望 在进入一下页失败时,可以将current page 修改回来。
另外希望 可以get到 headerview title 的内容。

code:

  • (void)nextClicked:(UIButton *)sender
    {
    sender.imageEdgeInsets = UIEdgeInsetsMake(15, 0, 15, 0);
    NSDate *currentMonth =self.calendar.currentPage;
    // FSCalendarHeaderView *headerview = self.calendar.calendarHeaderView;
    NSDate *nextMonth = [self.gregorian dateByAddingUnit:NSCalendarUnitMonth value:1 toDate:currentMonth options:0];
    NSLog(@"currentMonth:%@",currentMonth);
    NSLog(@"nextMonth:%@",nextMonth);
    [self.calendar setCurrentPage:nextMonth animated:YES];
    }

  • (void)calendarCurrentPageDidChange:(FSCalendar *)calendar{
    NSLog(@"self.calendar.currentPage:%@",self.calendar.currentPage);
    [self juddeNextButtonisEnable];
    }

log:
//第一次点下一页
2024-04-09 16:14:39.592594+0800 currentMonth:Mon Jan 1 00:00:00 2024
2024-04-09 16:14:39.592738+0800 nextMonth:Thu Feb 1 00:00:00 2024
2024-04-09 16:14:39.593271+0800 self.calendar.currentPage:Thu Feb 1 00:00:00 2024
//第二次点一下页
2024-04-09 16:14:43.043717+0800 currentMonth:Thu Feb 1 00:00:00 2024
2024-04-09 16:14:43.043904+0800 nextMonth:Fri Mar 1 00:00:00 2024
2024-04-09 16:14:43.044649+0800 self.calendar.currentPage:Fri Mar 1 00:00:00 2024

@mpmpmp911 mpmpmp911 changed the title 当进入下一页中断后,currentPage 设置不正确。when go not set right 当进入下一页中断后,currentPage 设置不正确。when go to next page interrupt,currentPage not return right Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant