THDatePickerViewController.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. //
  2. // THDatePickerViewController.h
  3. // THCalendarDatePicker
  4. //
  5. // Created by chase wasden on 2/10/13.
  6. // Adapted by Hannes Tribus on 31/07/14.
  7. // Copyright (c) 2014 3Bus. All rights reserved.
  8. //
  9. #import <UIKit/UIKit.h>
  10. #import <QuartzCore/QuartzCore.h>
  11. #import "UIViewController+KNSemiModal.h"
  12. #import "THDateDay.h"
  13. NS_ASSUME_NONNULL_BEGIN
  14. typedef NS_ENUM(NSInteger, THDatePickerSelectionType) {
  15. THDatePickerSelectionTypeSingle,
  16. THDatePickerSelectionTypeMulti,
  17. THDatePickerSelectionTypeRange
  18. };
  19. @class THDatePickerViewController;
  20. @protocol THDatePickerDelegate <NSObject>
  21. -(void)datePickerDonePressed:(THDatePickerViewController *)datePicker;
  22. -(void)datePickerCancelPressed:(THDatePickerViewController *)datePicker;
  23. @optional
  24. -(void)datePicker:(THDatePickerViewController *)datePicker selectedDate:(NSDate *)selectedDate;
  25. -(void)datePicker:(THDatePickerViewController *)datePicker deselectedDate:(NSDate *)deselectedDate;
  26. -(void)datePickerDidHide:(THDatePickerViewController *)datePicker;
  27. -(void)datePicker:(THDatePickerViewController *)datePicker changedMonth:(NSInteger)month year:(NSInteger)year;
  28. @end
  29. @interface THDatePickerViewController : UIViewController <THDateDayDelegate>
  30. +(THDatePickerViewController * __nonnull)datePicker;
  31. @property (strong, nonatomic) NSDate * date;
  32. @property (weak, nonatomic) id<THDatePickerDelegate> delegate;
  33. @property (strong, nonatomic) UIColor *selectedBackgroundColor;
  34. @property (strong, nonatomic) UIColor *currentDateColor;
  35. @property (strong, nonatomic) UIColor *currentDateColorSelected;
  36. @property (nonatomic) float autoCloseCancelDelay;
  37. @property (strong, nonatomic) NSTimeZone *dateTimeZone;
  38. @property (nonatomic, getter=isRounded) BOOL rounded;
  39. @property (nonatomic, getter=isHistoryFutureBasedOnInternal) BOOL historyFutureBasedOnInternal;
  40. @property (weak, nonatomic) IBOutlet UIView *toolbarBackgroundView;
  41. @property (nonatomic) float slideAnimationDuration;
  42. @property (strong, nonatomic) NSString* dateTitle;
  43. @property (strong, nonatomic) NSArray * selectedDates;
  44. - (void)setDateHasItemsCallback:(BOOL (^)(NSDate * date))callback;
  45. /*! Enable Clear Date Button
  46. * \param allow should show "clear date" button
  47. */
  48. - (void)setAllowClearDate:(BOOL)allow;
  49. /*! Enable Multi Day Selection
  50. * \param type selection of multiple days
  51. */
  52. - (void)setSelectionType:(THDatePickerSelectionType)type;
  53. /*! Enable Ok Button when selected Date has already been selected
  54. * \param allow should show ok button
  55. */
  56. - (void)setAllowSelectionOfSelectedDate:(BOOL)allow;
  57. /*! Use Clear Date Button as "got to Today"
  58. * \param beTodayButton should use "clear date" button as today
  59. */
  60. - (void)setClearAsToday:(BOOL)beTodayButton;
  61. /*! Should the view be closed on selection of a date
  62. * \param autoClose should close view on selection
  63. */
  64. - (void)setAutoCloseOnSelectDate:(BOOL)autoClose;
  65. /*! Should it be possible to select dates in history
  66. * \param disableHistorySelection should it be possible?
  67. */
  68. - (void)setDisableHistorySelection:(BOOL)disableHistorySelection;
  69. /*! Should it be possible to select dates in future
  70. * \param disableFutureSelection should it be possible?
  71. */
  72. - (void)setDisableFutureSelection:(BOOL)disableFutureSelection;
  73. /*! Should it be possible to select dates in history up to a number of days (including today) or 0 if any date
  74. * \param daysInHistory how many days?
  75. */
  76. - (void)setDaysInHistorySelection:(NSUInteger)daysInHistory;
  77. /*! Should it be possible to select dates in future up to a number of days (including today) or 0 if any date
  78. * \param daysInFuture how many days?
  79. */
  80. - (void)setDaysInFutureSelection:(NSUInteger)daysInFuture;
  81. /*! Set the timeZone by name to be used. Valid timezones can be retrieved using [NSTimeZone knownTimeZoneNames]
  82. * \param name the name of the timezone to be used
  83. * \return successful?
  84. */
  85. - (BOOL)setDateTimeZoneWithName:(NSString *)name;
  86. /*! Should it be possible to fast switch the year
  87. * \param disableYearSwitch should it be possible?
  88. */
  89. - (void)setDisableYearSwitch:(BOOL)disableYearSwitch;
  90. /*! Set date range
  91. * \param fromDate range from
  92. * \param toDate range to
  93. */
  94. - (void)setDateRangeFrom:(NSDate *)fromDate toDate:(NSDate *)toDate;
  95. /*! Set calendar title
  96. * \param dateTitle calendar title
  97. */
  98. - (void)setDateTitle:(NSString*)dateTitle;
  99. /*! Redraw the calendar to update the dot indicators
  100. */
  101. - (void)redraw;
  102. @end
  103. NS_ASSUME_NONNULL_END