Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. //
  2. // Copyright (c) 2012 Jason Kozemczak
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
  5. // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
  6. // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
  7. // and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
  8. //
  9. // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  10. //
  11. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  12. // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  14. // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  15. // OTHER DEALINGS IN THE SOFTWARE.
  16. //
  17.  
  18. @protocol CKCalendarDelegate;
  19.  
  20. @interface CKDateItem : NSObject
  21.  
  22. @property (nonatomic, strong) UIColor *backgroundColor;
  23. @property (nonatomic, strong) UIColor *selectedBackgroundColor;
  24. @property (nonatomic, strong) UIColor *textColor;
  25. @property (nonatomic, strong) UIColor *selectedTextColor;
  26.  
  27. @end
  28.  
  29. typedef enum {
  30. startSunday = 1,
  31. startMonday = 2,
  32. } CKCalendarStartDay;
  33.  
  34. @interface CKCalendarView : UIView
  35.  
  36. - (id)initWithStartDay:(CKCalendarStartDay)firstDay;
  37. - (id)initWithStartDay:(CKCalendarStartDay)firstDay eventDates:(NSArray *)eventDates;
  38. - (id)initWithStartDay:(CKCalendarStartDay)firstDay frame:(CGRect)frame;
  39.  
  40. @property (nonatomic) CKCalendarStartDay calendarStartDay;
  41. @property (nonatomic, strong) NSLocale *locale;
  42.  
  43. @property (nonatomic, readonly) NSArray *datesShowing;
  44. @property (nonatomic, strong) NSArray *eventDates;
  45.  
  46. @property (nonatomic) BOOL onlyShowCurrentMonth;
  47. @property (nonatomic) BOOL adaptHeightToNumberOfWeeksInMonth;
  48.  
  49. @property (nonatomic, weak) id<CKCalendarDelegate> delegate;
  50.  
  51. // Theming
  52. @property (nonatomic, strong) UIFont *titleFont;
  53. @property (nonatomic, strong) UIColor *titleColor;
  54. @property (nonatomic, strong) UIFont *dateOfWeekFont;
  55. @property (nonatomic, strong) UIColor *dayOfWeekTextColor;
  56. @property (nonatomic, strong) UIFont *dateFont;
  57.  
  58. - (void)setMonthButtonColor:(UIColor *)color;
  59. - (void)setInnerBorderColor:(UIColor *)color;
  60. - (void)setDayOfWeekBottomColor:(UIColor *)bottomColor topColor:(UIColor *)topColor;
  61.  
  62. - (void)selectDate:(NSDate *)date makeVisible:(BOOL)visible;
  63. - (void)reloadData;
  64. - (void)reloadDates:(NSArray *)dates;
  65.  
  66. // Helper methods for delegates, etc.
  67. - (BOOL)date:(NSDate *)date1 isSameDayAsDate:(NSDate *)date2;
  68. - (BOOL)dateIsInCurrentMonth:(NSDate *)date;
  69.  
  70. @end
  71.  
  72. @protocol CKCalendarDelegate <NSObject>
  73.  
  74. @optional
  75. - (void)calendar:(CKCalendarView *)calendar configureDateItem:(CKDateItem *)dateItem forDate:(NSDate *)date;
  76. - (BOOL)calendar:(CKCalendarView *)calendar willSelectDate:(NSDate *)date;
  77. - (void)calendar:(CKCalendarView *)calendar didSelectDate:(NSDate *)date;
  78. - (BOOL)calendar:(CKCalendarView *)calendar willDeselectDate:(NSDate *)date;
  79. - (void)calendar:(CKCalendarView *)calendar didDeselectDate:(NSDate *)date;
  80.  
  81. - (BOOL)calendar:(CKCalendarView *)calendar willChangeToMonth:(NSDate *)date;
  82. - (void)calendar:(CKCalendarView *)calendar didChangeToMonth:(NSDate *)date;
  83.  
  84. - (void)calendar:(CKCalendarView *)calendar didLayoutInRect:(CGRect)frame;
  85.  
  86. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement