我的日历工作正常我在我的tapku日历中显示日历中的活动,我也可以编辑它们以便编辑我正在使用 EKEventEditViewController 所以编辑完成后再
- (void)eventEditViewController:(EKEventEditViewController *)controller
didCompleteWithAction:(EKEventEditViewAction)action
被调用,这就是我尝试更新我的日历的方式
TKCalendarMonthViewController *tk = [[TKCalendarMonthViewController alloc]init];
[tk loadView];
loadview 方法如下,现在我将在评论中解释什么错误
加载我的日历时会调用此方法。因此,为了再次加载它我再次调用此方法
- (void) loadView{
[super loadView];
_monthView = [[TKCalendarMonthView alloc] initWithSundayAsFirst:_sundayFirst];
_monthView.delegate = self;
_monthView.dataSource = self;
NSLog(@"::%@",_monthView.dataSource);
NSLog(@"::%@",_monthView.delegate);
[self.view addSubview:_monthView];
[_monthView reload]; // reload method get called
}
- (void) reload{
NSArray *dates = [TKCalendarMonthTiles rangeOfDatesInMonthGrid:[currentTile monthDate] startOnSunday:sunday];
NSLog(@"%@",dates);
NSLog(@"%@",self.dataSource);
// below calendarMonthView:self method get called when my cal is getting called first time by it self but when i try by creating object of class like i showed in that delegate method then below method is not getting called and this is why my cal is not getting updated
// SO THE PROBLEM IS THIS METHOD IS NOT GETTING CALLED
NSArray *ar = [self.dataSource calendarMonthView:self marksFromDate:[dates objectAtIndex:0] toDate:[dates lastObject]];
TKCalendarMonthTiles *refresh = [[TKCalendarMonthTiles alloc] initWithMonth:[currentTile monthDate] marks:ar startDayOnSunday:sunday];
[refresh setTarget:self action:@selector(tile:)];
[self.tileBox addSubview:refresh];
[currentTile removeFromSuperview];
currentTile = refresh;
}
所有NSLog都是打印,其值不为空。
答案 0 :(得分:0)
@property (strong,nonatomic) TKCalendarMonthView *monthView;
[self.monthView reload];
note: do not @synthesize property