Starting from yesterday, prepare the book from objective-c programming:the Big Nerd Ranch Guide and learn oc from the ground up, and improve your English reading ability by the way.
The focus of today's knowledge is on the difference between class methods and instance methods:
NSDate *now = [NSDate Date];
We say the date method is a class method. That's, you cause the method to execute by sending a message to the nsdate class. The date method returns a pointer to an instance of NSDate.
Date is a class method that sends a message to the NSDate class, which returns a value of NSDate instance pointer.
Double seconds = [now timeIntervalSince1970];
We say that timeIntervalSince1970 are an instance method. You cause the method to execute by sending a message to an instance of the class. The timeIntervalSince1970 method returns a double.
TimeIntervalSince1970 is an instance method that, when you execute the method, sends a message to an instance of the class that returns a value of type double.
NSDate *later = [now datebyaddingtimeinterval:100000];
Datebyaddingtimeinterval: is another instance method. This method takes one argument. You can determine the colon in the method name. This method also returns a pointer to an instance of NSDate.
Datebyaddingtimeinterval is another instance variable. This method requires a parameter. Distinguished by a colon in the method name. The method also returns a pointer to the NSDate instance.
iOS class methods, instance methods