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

delegate method for when closing by touching outside calendar? #22

Closed
cdbeshore opened this issue Feb 10, 2015 · 2 comments
Closed

delegate method for when closing by touching outside calendar? #22

cdbeshore opened this issue Feb 10, 2015 · 2 comments

Comments

@cdbeshore
Copy link

Hi. I can't find a way to track when a user brings up the calendar, then dismisses by touching outside the calendar. It doesn't call datePickerCancelPressed. Maybe I'm missing something. Any help is appreciated.

Love this simple calendar control. Fits my app well.

@hons82
Copy link
Owner

hons82 commented Feb 16, 2015

Hi,
actually you're supposed to close the picker by yourself when datePickerCancelPressed is called, so it can't call that specific method.
If you'd check the code of KNSemiModalViewController which I used to create the semitransparent background, you'd see these 3 notifications

#define kSemiModalDidShowNotification @"kSemiModalDidShowNotification"
#define kSemiModalDidHideNotification @"kSemiModalDidHideNotification"
#define kSemiModalWasResizedNotification @"kSemiModalWasResizedNotification"

I can understand that you don't wanna catch the notification so I added an optional method in the protocol that will be called when the date picker has been hidden.

@protocol THDatePickerDelegate <NSObject>

-(void)datePickerDonePressed:(THDatePickerViewController *)datePicker;
-(void)datePickerCancelPressed:(THDatePickerViewController *)datePicker;

@optional

-(void)datePicker:(THDatePickerViewController *)datePicker selectedDate:(NSDate *)selectedDate;
-(void)datePickerDidHide:(THDatePickerViewController *)datePicker;

@end

@cdbeshore
Copy link
Author

awesome. Thanks for adding this. I always try to think of all they ways that a user would cancel the modal and catch them to update the UI. Thanks for this date picker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants