iPhone sdk- Save Last Selected Date in KALViewController

I have used KALViewcontroller API to display calendar in my iPhone app. I want to save the last selected date and display it as 'highlighted' when the calendar appears again. Currently it shows Today's date.

in KALViewController.m a function -(void)showAndSelectToday is responsible to show today's date and highlight today's tile.

[[self calendarView] selectTodayIfVisible];

//where *calendarView* is
- (KalView*)calendarView 
{ 
    checkDateConf = TRUE; 
    checkDate = FALSE; 
    return (KalView*)self.view; 
}

In KalView.m

[gridView selectTodayIfVisible];

//Where gridView is KalGridView gridView;

In KALGridView.m

selectTodayIfVisible is declared

- (void)selectTodayIfVisible
{
  KalTileView *todayTile = [frontMonthView todaysTileIfVisible];
  if (todayTile)
    self.selectedTile = todayTile;
}

Please guide me how I will highlight selected date.

Answers


TO detect which date is selected, I've done this way:

in KalViewController look for didSelectDate (delegate Method) and add Notification post.

#pragma mark KalViewDelegate protocol

    - (void)didSelectDate:(KalDate *)date
    {
  //NSLog(@"DID select DATE:%@",date);
  self.selectedDate = [date NSDate];
  [[NSNotificationCenter defaultCenter] postNotificationName:@"DATA_SELECTED" object:[NSString stringWithFormat:@"%@",date]];
  NSDate *from = [[date NSDate] cc_dateByMovingToBeginningOfDay];
  NSDate *to = [[date NSDate] cc_dateByMovingToEndOfDay];
  [self clearTable];
  [dataSource loadItemsFromDate:from toDate:to];
  [tableView reloadData];
  [tableView flashScrollIndicators];
}

Then in your view Controller that use Kal receive this post just like:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userSelectDate:) name:@"DATA_SELECTED" object:nil];

and the method called is:

-(void)userSelectDate:(NSNotification*)notification{
    NSLog(@"date selected:%@",[notification object]);
}

Need Your Help

dialing on iphone/ipod touch not working with documented procedures

iphone xcode ios-simulator

I'm trying to set up an iphone app to the phone number of a various sports store using the tel:// url passing method-