Dark Horse programmer----Memory management of the third--"@property memory Management"

Source: Internet
Author: User

Memory Management--"@property memory Management"1. parameters related to setter memory management in the@property
    • retain : release old value ,retain new value (for OC object type);
    • Assign : Direct Assignment , ( default , applies to non-OC object types);
    • copy : release old value ,copy new value ;
2.whether the parameters of S- etter are generated inthe @property
    • readonly : Only a getter declaration and implementation will be generated;
    • ReadWrite : Both the declaration and implementation of setter and getter are generated;
3. Multithreading-related parameters in the @property
    • nonatomic : high performance (usually with this);
    • Atomic : low performance ( default );
4. Setting the use of setter and getter names in the @property
    • setter : Set the name of the setter method, must have a colon ;
    • Getter : Sets the name of the getter method (typically used in bool type, the method name of a getter of type bool, usually starting with is )
5. cyclic retain and @class
    • @class : Just tell the compiler that a name is a class : for example,@class person; Just tell the compiler that the person is a class ( internal details are not known );
    • Specification for referencing a class in development:
1. In. h fileUsed@class to declare the class(Cannot use #import, otherwise it will appearCircular References); 2. In. m fileUsed#importTo contain all the things of the class;
    • Solutions for Circular references at both ends:
1. End Withretain parameters (@property ) ; 2. End WithAssign parameters (@property ) ;Note: Used theAssign, which is calledSet MethodWouldn't do it.retain, itDon'tInDeallocmethod to do this object in therelease.

Dark Horse programmer----Memory management of the third--"@property memory Management"

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.