0

我的日历工作得很好我在我的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 都是打印,其中没有一个为 null。

4

1 回答 1

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

 note: do not @synthesize property
于 2013-08-22T13:02:18.910 回答