9
9
10
10
#import " JTCircleView.h"
11
11
12
+ #import < SDWebImage/UIImageView+WebCache.h>
13
+
12
14
@interface JTCalendarDayView (){
13
15
UIView *backgroundView;
14
16
JTCircleView *circleView;
15
17
UILabel *textLabel;
16
18
JTCircleView *dotView;
19
+ UIImageView *imageView;
17
20
18
21
BOOL isSelected;
19
22
@@ -81,6 +84,11 @@ - (void)commonInit
81
84
dotView.hidden = YES ;
82
85
}
83
86
87
+ {
88
+ imageView = [UIImageView new ];
89
+ [self addSubview: imageView];
90
+ }
91
+
84
92
{
85
93
UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc ] initWithTarget: self action: @selector (didTouch )];
86
94
@@ -105,7 +113,9 @@ - (void)configureConstraintsForSubviews
105
113
{
106
114
textLabel.frame = CGRectMake (0 , 0 , self.frame .size .width , self.frame .size .height );
107
115
backgroundView.frame = CGRectMake (0 , 0 , self.frame .size .width , self.frame .size .height );
108
-
116
+
117
+ imageView.frame = CGRectMake (self.frame .size .width /2 - 15 , (self.frame .size .height / 2 ) - 15 , 30 , 30 );
118
+ // imageView.backgroundColor = [UIColor redColor];
109
119
110
120
CGFloat sizeCircle = MIN (self.frame .size .width , self.frame .size .height );
111
121
CGFloat sizeDot = sizeCircle;
@@ -260,10 +270,27 @@ - (void)setIsOtherMonth:(BOOL)isOtherMonth
260
270
261
271
- (void )reloadData
262
272
{
263
- dotView.hidden = ![self .calendarManager.dataCache haveEvent: self .date];
264
-
273
+ NSInteger eventType = [self .calendarManager.dataCache haveEvent: self .date];
265
274
BOOL selected = [self isSameDate: [self .calendarManager currentDateSelected ]];
266
275
[self setSelected: selected animated: NO ];
276
+
277
+ if (eventType == 1 ) { // normal event
278
+ imageView.hidden = YES ;
279
+ dotView.hidden = NO ;
280
+ // dotView.color = [UIColor greenColor];
281
+ } else if (eventType == 2 ) { // match
282
+ dotView.hidden = YES ;
283
+ textLabel.hidden = YES ;
284
+ imageView.hidden = NO ;
285
+
286
+ NSString *matchImageUrl = [self .calendarManager.dataSource calendarGetMatchImage: self .calendarManager date: self .date];
287
+ [imageView sd_setImageWithURL: [NSURL URLWithString: matchImageUrl]];
288
+ } else {
289
+ imageView.hidden = YES ;
290
+ textLabel.hidden = NO ;
291
+ dotView.hidden = YES ;
292
+ // dotView.color = [self.calendarManager.calendarAppearance dayDotColor];
293
+ }
267
294
}
268
295
269
296
- (BOOL )isToday
0 commit comments