Skip to content

Loading…

Bug Fix for Calendar Month Grid with touch points. #174

Merged
merged 1 commit into from

2 participants

@nakanomi

Hi Devin,

Thank you for the wonderful library.
However, it might be worrisome when using.
Since it seems to be a bug, a pullrequest is sent.

On the day of some conditions(e.g. 2012/07/29 row is over 4),
a UIViewController allocated and pushViewController it
in TKCalendarMonthView.didSelectDate App will be crash in .

Although it seems to be OS instead of a library,
a fundamental cause is happy if you profit.

@devinross devinross merged commit 4095204 into devinross:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 29, 2012
  1. @nakanomi

    Fixes bug crash when UIViewController allocated and pushViewControlle…

    nakanomi committed
    …r it in delegate.didSelectDate.
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/TapkuLibrary/TKCalendarMonthView.m
View
8 src/TapkuLibrary/TKCalendarMonthView.m
@@ -487,6 +487,14 @@ - (NSDate*) dateSelected{
- (void) reactToTouch:(UITouch*)touch down:(BOOL)down{
CGPoint p = [touch locationInView:self];
+ /*
+ When a UIViewController allocated and pushViewController it in delegate.- (void)calendarMonthView:(TKCalendarMonthView *)monthView didSelectDate:(NSDate *)date.
+ p.x is over self.bounds.size.width(a cause -- unknown).
+ And column becomes 7 or more.
+ It is if it is the 4th [ or more ] row, App will crash (e.g. select 2012/07/29).
+ So I added check range of p.x.
+ */
+ if(p.x > self.bounds.size.width || p.x < 0) return;
if(p.y > self.bounds.size.height || p.y < 0) return;
int column = p.x / 46, row = p.y / 44;
Something went wrong with that request. Please try again.