NSDate class
NSDate is the class that represents the date in the foundation framework, which is used to get the current time, which includes: Month Day, time division, 0 timezone, and time zone. Note that it must be 0 time zone!
Common methods:
1.datewithtimeinterval:sincedate:. The first parameter is a floating-point number that represents seconds, the second argument is a variable of type nsdate, and the method returns a NSDate object whose value is the time that the second parameter represents and the time it takes to get the number of seconds. For example, instantiating a NSDate object represents the current time, the first parameter fills the 24*60*60 (the number of seconds in a day), which will get the nsdate variable at this time tomorrow.
2.timeintervalsincedate:. The argument is the NSDate type, which returns a floating-point number of type Nstimeinterval (double), representing how many seconds have elapsed since the time the parameter was given.
3.timeIntervalSince1970:. Indicates how many seconds have elapsed since January 1, 1970 (January 1, 1970 is the time of Birth of Unix).
NSDateFormatter class
The NSDateFormatter class is a date format class that works by NSDate objects with NSString objects.
Common methods:
1.Setdateformat:. Format the date display, such as: @ "Yyyy-mm-dd HH:mm:ss".
2.stringfromdate:. Converts a Date object to a String object.
3.datefromstring:. Converts a string object to a Date object.
Category (category)
Characteristics:
1. The class is a class that is internal to the system, or a class that does not have source code, and cannot add an instance variable
2. The added method becomes part of the original class, and subclasses can still use the
3. Class purpose file Fame original class name + file name
4. You can either add an instance method or add a class method
For example, add a sort method to the Nsarray class so that each Nsarray object can execute the sorting method directly.
Extension (Extension)
Characteristics:
1. Extensions appear for custom class extension functions
2. Above the class's. m file, use the @interface keyword to build the extension
3. In the extension, we can either declare a method or declare an instance variable or property
4. The newly added content belongs to the private part of this class
Protocol (PROTOCOL)
"Objective-c Study record" 30th day