O'Reilly logo

Objective-C Programming: The Big Nerd Ranch Guide by Mikey Ward, Aaron Hillegass

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Multiple arguments

What if you want to know the day of the month (e.g., June 1st) for an NSDate object? An NSDate does not know this information. Instead, you must ask an instance of NSCalendar.

NSCalendar is another Foundation class. You can create an instance of NSCalendar by sending the NSCalendar class the currentCalendar message.

The class method currentCalendar will return the address of an NSCalendar instance that matches the user’s settings. (In most western countries, the Gregorian calendar is the default, but there are several other calendars, like the Hebrew calendar and the Islamic calendar.) Ask the NSCalendar class for an instance of NSCalendar.

#​i​m​p​o​r​t​ ​<​F​o​u​n​d​a​t​i​o​n​/​F​o​u​n​d​a​t​i​o​n​.​h​>​ i​n​t​ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required