issue in reloading tapku calendar

214 Views Asked by At

My calendar is working perfectly I show events from calendar in my tapku calendar and I can also edit them so for editing I am using EKEventEditViewController so when editing is completed then

- (void)eventEditViewController:(EKEventEditViewController *)controller
          didCompleteWithAction:(EKEventEditViewAction)action

get called and this is how I try to update My calendar here

TKCalendarMonthViewController *tk = [[TKCalendarMonthViewController  alloc]init];

    [tk loadView];

loadview method is as below and now I will explain whats wrong in comment

this method get called when My calendar is loading. So for loading it again I am calling this method again

- (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;

}

All NSLog's are prints with values non of them is null.

1

There are 1 best solutions below

1
On
 @property (strong,nonatomic) TKCalendarMonthView *monthView;
 [self.monthView reload];

 note: do not @synthesize property