Get all days of any month with objective-c

后端 未结 2 985
没有蜡笔的小新
没有蜡笔的小新 2020-12-14 19:23

A seemingly simple question...how can I return a list of days for any specified month?

NSDate *today = [NSDate date]; //Get a date object for today\'s date
N         


        
2条回答
  •  心在旅途
    2020-12-14 19:48

    You can make your date with pretty much any string:

    NSDate *date = [NSDate dateWithNaturalLanguageString:@"January"];
    

    Then the rest of your code will work as-is to give you back the NSRange for the number of days in January.

提交回复
热议问题