Objective-c series-@ Property & amp; point syntax, objective-c

Source: Internet
Author: User

Objective-c series-@ Property & point syntax, objective-c

// Explain the meanings of modifiers in parentheses behind the property:

// Nonatomic non-thread-safe non-atomic operations features: high efficiency of operation variables

// Atomic thread-safe atomic operations features: low efficiency of operation variables

//

// Retain strongly references instance variables, that is, the setter method contains:

//-(Void) setXXX :( xxx) arg

//{

// [_ Attribute name release];

// _ Attribute name = [arg retain];

//}

// And the dealloc method needs to be rewritten for this class

// All other class objects with non-oc strings must use retain

//

// Copy, that is, the setter method contains:

//-(Void) setXXX :( xxx) arg

//{

// [_ Attribute name release];

// _ Attribute name = [arg copy];

//}

// And the dealloc method needs to be rewritten for this class

// Copy applies to: oc string, block

//

// Assign is assigned directly, that is, the setter method contains:

//-(Void) setXXX :( xxx) arg

//{

// _ Attribute name = arg;

//}

// Applicable to all non-object data types: int float, char, struct

// Union, void *, SEL, class bool Enumeration

// Readonly does not provide the setter method externally, so the instance variables cannot be modified externally.

**************************************** ********

// Point syntax

@ Class Person;

Person * person = [[Person alloc] init];

Person. name = @ "Haiyan"; // setter Method

NSString * love = person. name; // getter Method

End

Related Article

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.