我是Objective-C的新手。我正在尝试构建一个iPhone应用程序。在那里,我想展示一个完整的年历。你能帮助我吗?
答案 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)
查看本教程(包含源代码)。