0

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.

Nevil Lad
  • 533
  • 6
  • 20
java
  • 239
  • 5
  • 20

1 Answers1

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

 note: do not @synthesize property
java
  • 239
  • 5
  • 20
  • You should avoid answering in just code unless it is 100% obvious what to do with it. For this Q&A to potentially benefit other users in the future, please edit this question with an explanation of how your code solves the OP's question. – Michael Irigoyen Aug 22 '13 at 13:21