Commit 3db0083 1 parent 80b282b commit 3db0083 Copy full SHA for 3db0083
File tree 2 files changed +8
-20
lines changed
2 files changed +8
-20
lines changed Original file line number Diff line number Diff line change @@ -55,18 +55,12 @@ - (void)viewDidLoad
55
55
[self .calendar setContentView: self .calendarContentView];
56
56
[self .calendar setDataSource: self ];
57
57
58
- [self createRandomEvents ];
59
- }
60
-
61
- - (void )viewDidAppear : (BOOL )animated
62
- {
63
- [super viewDidAppear: animated];
58
+ [self .calendar reloadData ];
64
59
65
- [self .calendar reloadData ]; // Must be call in viewDidAppear
60
+ [self createRandomEvents ];
66
61
}
67
62
68
- // Update the position of calendar when rotate the screen, call `calendarDidLoadPreviousPage` or `calendarDidLoadNextPage`
69
- - (void )didRotateFromInterfaceOrientation : (UIInterfaceOrientation)fromInterfaceOrientation
63
+ - (void )viewDidLayoutSubviews
70
64
{
71
65
[self .calendar repositionViews ];
72
66
}
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ Your UIViewController must implement `JTCalendarDataSource`
33
33
``` objective-c
34
34
#import < UIKit/UIKit.h>
35
35
36
- #import " JTCalendar.h"
36
+ #import < JTCalendar.h>
37
37
38
38
@interface ViewController : UIViewController <JTCalendarDataSource>
39
39
@@ -59,13 +59,13 @@ Your UIViewController must implement `JTCalendarDataSource`
59
59
[ self.calendar setMenuMonthsView: self .calendarMenuView] ;
60
60
[ self.calendar setContentView: self .calendarContentView] ;
61
61
[ self.calendar setDataSource: self ] ;
62
+
63
+ [ self.calendar reloadData] ;
62
64
}
63
65
64
- - (void)viewDidAppear:(BOOL)animated
66
+ - (void)viewDidLayoutSubviews
65
67
{
66
- [ super viewDidAppear: animated ] ;
67
-
68
- [ self.calendar reloadData] ; // Must be call in viewDidAppear
68
+ [ self.calendar repositionViews] ;
69
69
}
70
70
71
71
- (BOOL)calendarHaveEvent:(JTCalendar * )calendar date:(NSDate * )date
@@ -78,12 +78,6 @@ Your UIViewController must implement `JTCalendarDataSource`
78
78
NSLog(@"%@", date);
79
79
}
80
80
81
- // Manage rotation
82
- - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
83
- {
84
- [ self.calendar repositionViews] ;
85
- }
86
-
87
81
@end
88
82
89
83
```
You can’t perform that action at this time.
0 commit comments