1

I am using the Tapku calendar in my project. I have all the dates ready and marked. The only problem I'm facing is that, I want a popup to appear when the user selects one of the predefined dates. How do I address that in an 'if statement'?

nenos
  • 11
  • 1
  • It would be helpful if you could include some of your code and explain what you have tried already! – Emil Oct 06 '12 at 14:36
  • @ nenos. How did you marked the dates? It will be helpful if you tell the idea. – iOS Feb 13 '13 at 13:48

3 Answers3

0

I'm assuming you are using the month view TKCalendarMonthTableViewController as opposed to the day view. Every time a user taps a tile in the month view grid the calendarMonthView:didSelectDate method is called. You need to implement your logic there.

- (void) calendarMonthView:(TKCalendarMonthView*)monthView didSelectDate:(NSDate*)date{
    // if your predefined date = passed date, show your popup (UIAlertView?)
}
Jon
  • 3,208
  • 1
  • 19
  • 30
  • Thanks Jon. How do I specify if a certain date is selected then the popup will appear? I can't seem to work out the if-statement. I want the popup to appear only on the cells that contain the predefined dates. – nenos Sep 24 '12 at 05:08
0

It is hard to give a specific answer to your question without knowing how you are storing the dates that are marked. Tapku Calendar defualts to a "dataArray" that holds boolean values (in the form of NSNumbers) for the dates in which need a mark displayed on them. This array is passed to create the marks on the calendar. You could use that same type of logic for your if-statement.

Then you would have something like:

-(void)calendarMonthView:(TKCalendarMonthView*)monthView didSelectDate:(NSDate*)date{

    if([[dataArray objectAtIndex:date.dateinformation.day - 1]boolValue])
        {
            //Pop view code
        }

 }

The dataArray stores boolean values for each day of the month currently being shown. Since days start at 1 and go to 28-31, we have to subtract off 1 due to arrays starting at 0. Another way you could do this is to check whether the dataDictionary has any objects in it for the didSelectDate.

I have not tried this specific code, but it could give you some ideas.

TMilligan
  • 3,520
  • 1
  • 18
  • 12
0

For this, you can save the marked dates in an array, and in the following method:

- (void)calendarMonthView:(TKCalendarMonthView *)monthView didSelectDate:(NSDate *)d {
NSLog(@"selected Date IS - %@",d);
}

you can match the date "d" with the date selected and if the dates are equal, then you can show the alert or perform any action you require.

Ashutosh
  • 2,215
  • 14
  • 27