使用完整的年度日历,目标c

时间:2011-08-26 09:16:46

标签: iphone xcode calendar

我是Objective-C的新手。我正在尝试构建一个iPhone应用程序。在那里,我想展示一个完整的年历。你能帮助我吗?

2 个答案:

答案 0 :(得分:0)

NSCalendar *objCal=[NSCalendar currentCalendar];
unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit |  NSDayCalendarUnit | NSTimeZoneCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit;
NSDateComponents *comps = [objCal components:unitFlags fromDate:startDate];  
NSInteger mont = [comps month]; 
NSInteger daysa = [comps day];    
NSInteger years = [comps year]; 

Here StartDate Can pass Date Obj.
IF You Want present [NSDate date];

答案 1 :(得分:0)

查看本教程(包含源代码)。

链接:iPhone Tutorial: Adding a Calendar

也请查看此问题:How can I use Calendar in my iPhone Application?