OBJECTIVE-C Series-@Property & Point syntax

Source: Internet
Author: User

explains the meaning of the modifier in parentheses behind the property :

Nonatomic Non-thread-safe non-atomic operation is characterized by high efficiency of operating variables

Atomic Thread -safe atomic Operation is characterized by low efficiency of operating variables

//

The retain strong reference instance variable , that is, The setter method will have:

-(void) setxxx: (XXX) arg

//                                  {

[_ Property name release];

_ Property name = [arg retain];

//                                  }

and the class needs to override the Dealloc method

All other class objects that are not OC strings are used retain

//

Copy copy, that is, The setter method will have :

-(void) setxxx: (XXX) arg

//                                  {

[_ Property name release];

_ Property name = [arg copy];

//                                  }

and the class needs to override the Dealloc method

the object used by copy is : OC string, block

//

Assign direct assignment, that is, The setter method will be :

-(void) setxxx: (XXX) arg

//                                  {

_ Property name = arg;

//                                  }

data types that apply to all non-objects : int float, char, struct

Union, Void *, SEL, CLASS BOOL enumeration

ReadOnly does not provide setter methods , limit instance variables cannot be externally modified

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

Dot syntax

@class person;

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

Person.name = @ "Haiyan";//Setter method

NSString *love = person.name; Getter method

End

OBJECTIVE-C series [email protected]& DOT Syntax

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.