I created a custom calendar for my calendar app … but I have some problem which I would be grateful if you help me to do this , this code shows a single day .
for example day 2 , 4 , 13 , 24
- (NSString *) showPersianDay {
NSCalendar *persCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSPersianCalendar];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSLocale *IRLocal = [[NSLocale alloc] initWithLocaleIdentifier:@"fa_IR"];
[dateFormatter setLocale:IRLocal];
[dateFormatter setCalendar:persCalendar];
offsetComponents = [[NSDateComponents alloc] init];
offsetComponents.day = _dayNumber;
NSDate *nextDate = [persCalendar dateByAddingComponents:offsetComponents toDate:[NSDate date] options:0];
[dateFormatter setDateFormat:@"d"];
NSString *currDay = [dateFormatter stringFromDate:nextDate];
[NSString stringWithFormat:@"%@",currDay];
[persCalendar release];
[dateFormatter release];
return currDay;
}
I created a custom table for a month which shows days of a month , so when user tap on this number my date should change according to the numbers ,

for example today is 4 Jan — when user tap 6 Jan my date should change to the 6 Jan.
I don’t have to use some way like : day.text = @"6" or something …. I need return a real DATE, How can I modify my code to show specific day ?
thank you.
Maybe you should have the class return an NSDictionary with multiple keys. One key can contain the string value for the day number, the other can contain the date object.
Then on the other side you can display the dateString and cache the DateObj in the calendar cell. Hopefully this solves your question.