Skip to content

Commit 3db0083

Browse files
committed
Update README.md
1 parent 80b282b commit 3db0083

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

Example/Example/ViewController.m

+3-9
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,12 @@ - (void)viewDidLoad
5555
[self.calendar setContentView:self.calendarContentView];
5656
[self.calendar setDataSource:self];
5757

58-
[self createRandomEvents];
59-
}
60-
61-
- (void)viewDidAppear:(BOOL)animated
62-
{
63-
[super viewDidAppear:animated];
58+
[self.calendar reloadData];
6459

65-
[self.calendar reloadData]; // Must be call in viewDidAppear
60+
[self createRandomEvents];
6661
}
6762

68-
// Update the position of calendar when rotate the screen, call `calendarDidLoadPreviousPage` or `calendarDidLoadNextPage`
69-
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
63+
- (void)viewDidLayoutSubviews
7064
{
7165
[self.calendar repositionViews];
7266
}

README.md

+5-11
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Your UIViewController must implement `JTCalendarDataSource`
3333
```objective-c
3434
#import <UIKit/UIKit.h>
3535

36-
#import "JTCalendar.h"
36+
#import <JTCalendar.h>
3737

3838
@interface ViewController : UIViewController<JTCalendarDataSource>
3939

@@ -59,13 +59,13 @@ Your UIViewController must implement `JTCalendarDataSource`
5959
[self.calendar setMenuMonthsView:self.calendarMenuView];
6060
[self.calendar setContentView:self.calendarContentView];
6161
[self.calendar setDataSource:self];
62+
63+
[self.calendar reloadData];
6264
}
6365

64-
- (void)viewDidAppear:(BOOL)animated
66+
- (void)viewDidLayoutSubviews
6567
{
66-
[super viewDidAppear:animated];
67-
68-
[self.calendar reloadData]; // Must be call in viewDidAppear
68+
[self.calendar repositionViews];
6969
}
7070

7171
- (BOOL)calendarHaveEvent:(JTCalendar *)calendar date:(NSDate *)date
@@ -78,12 +78,6 @@ Your UIViewController must implement `JTCalendarDataSource`
7878
NSLog(@"%@", date);
7979
}
8080

81-
// Manage rotation
82-
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
83-
{
84-
[self.calendar repositionViews];
85-
}
86-
8781
@end
8882

8983
```

0 commit comments

Comments
 (0)