"Reading notes" ios-memory release

Source: Internet
Author: User

First, some programmers like to organize the code of the memory cleanup into one place in the function, while others prefer to automatically dispose of the objects at the creation point to avoid forgetting to release them later. Both of these methods are valid.

Second, the ID type represents a pointer to an object of any type, which is a generic object type. You can assign any object to a variable of type ID, or you can assign a variable of type ID to any type of object pointer. If a protocol name enclosed in angle brackets follows the ID, the compiler will know that you expect any type of object, as long as it adheres to the protocol.

Third, the concept of formal agreements, you can define a formal agreement by listing a set of method names in the @protocol section. An object can adopt this protocol by listing the name of the protocol enclosed in angle brackets after the class name in the @interface declaration. When an object takes a formal agreement, it commits to implementing every method of implementation that is listed in the protocol. If you do not implement all the methods in the protocol, the compiler will warn you to help you fulfill your commitments.

Reference: "Objective-c Basic Course"

  

"Reading notes" ios-memory release

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.