0

This is the method from Tapku and I want to call it from the controller

- (NSDate*) dateSelected{
if(selectedDay < 1 || selectedPortion != 1) return nil;

TKDateInformation info = [monthDate dateInformationWithTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
info.hour = 0;
info.minute = 0;
info.second = 0;
info.day = selectedDay;
NSDate *d = [NSDate dateFromDateInformation:info timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];


return d;

}

And I'm trying to call it like this and convert it to string format.

TKCalendarMonthView *tk=[[TKCalendarMonthView alloc] init];
NSDate *date=tk.dateSelected;// How can I call it?With the debug it shows it's null.
NSDateFormatter *selectedDate=[[NSDateFormatter alloc] init];
[selectedDate setDateFormat:@"yyyy-MM-dd"];
NSMutableString *stringDate=[NSMutableString stringWithFormat:@"%@",[selectedDate stringFromDate: date]]`

1 Answers1

0
NSDate *date= [tk dateSelected];

Makes it a function call (strictly speaking, send the object a message). Dot syntax is for getters/setters only. I strongly suggest reading upon objc basic first.

auspicious99
  • 3,902
  • 1
  • 44
  • 58
Max
  • 1,468
  • 10
  • 16
  • 3
    But the dot notation will generally work for a parameterless method. There's another problem. – Hot Licks Dec 21 '13 at 13:39
  • Changing the syntax is not gonna help in this case. Parameters in the target function `dateSelected` are not initialised hence this problem is there. – Akshat Singhal Dec 21 '13 at 13:41