IOS Learning Log 2015-3-16

Source: Internet
Author: User

The OBJECTIVE--C keyword Self is equivalent to this in Java, but it can be substituted for an object or a class, which means it can be used in static methods and in dynamic methods. Super is equivalent to the parent class, the function that can call the parent class nil equivalent to NULL in Java, null pointer #pragma comment code, with it, after you want to find this code can locate the code, generally in some callback methods, proxy methods commonly used to comment sel  function pointer address @select Gets the method of the class in memory of the pointer address @protocol protocol equivalent to the blood Draw class two function in Java description equivalent to the Java Tostringrespondstoselector to determine whether a method is implemented in three Rule 1 The function's scope a writes the method in. m, is private; public B in Java can modify function variables, but it seems to be used only in OC to modify variables, then OC distinguishes between public and private functions, as seen in the. h file has no definition 2 Description A position in the. m file b returns the format of [nstring stringwithformat:@ "",...] C estimates that the function is already in the parent class, we are the replication, for printing test D NSLog in the format character is%@, when the use of%@ output an object, OBJC will call an object description return the corresponding information for output, By default, if we do not override the description method, the output is the class name and address E to emphasize that you should never print out self in description, because the description method of the object is called when the self is output. This will cause a cycle of death. 3 RespondsToSelector1 instance method \ Class Method 2 Determines whether the class implements a Method 3 format Bool Buer = [Class \ Object Repondstose]ector: @select (test method name:); 4 protocol protocol A in obj C uses @protocol to define a set of method specifications, and the classes that implement this Protocol must implement the corresponding methods. Familiarity with object-oriented child shoes all know that the interface itself is the protocol specification for object behavior description. That is, in OBJC @protocol and other language interface definition is similar, but in OBJC interface keyword has been used to define the class, so it will no longer like C #, Java use interface to define the interface B a protocol can be extended from anotherA protocol, such as the above animaldelegate extends from NSObject, if you need to extend the middle of multiple protocols using commas separated, 3 and other high-level languages in the interface is different is not necessarily the method defined in the protocol must be implemented, We can set the keyword by @required and @optional, if not set the default is @required (note that OBJC is weak syntax, even if not implement the required method compile run will not error); C protocol is implemented by <>  A class can implement multiple protocols at the same time, separated by commas; the implementation of the D protocol can only be defined on the declaration of the class, not on the implementation of the Class E protocol can not define attributes, member variables, etc., can only define methods; 4 Rule 1 inherit 2 package

IOS Learning Log 2015-3-16

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.