Ios-properties Getting Started

Source: Internet
Author: User

In iOS, the properties of a class can have several modifiers that correspond to different property behaviors.

@property (ReadOnly) NSString *ReadOnly;//read-only, non-modifiable@property (ReadWrite) NSString *readwrite;//Readable writable , default@property (nonatomic) NSString *nonatomic;//Non-atomic operation, faster@property (atomic) NSString *atomic;//atomic operation, default@property (strong) NSString *strong;//strong references, default@property (weak) NSString *weak;//weak references, not holding objects//ARC prohibits the use of retain, as with strong//@property (retain) nsstring *retain;@property (assign) NSString *assign;//used to assign a value, the default@property (copy) NSString *copys;//The Copy property represents a deep copy, a full copy of the variable, a new pointer, no copy property, a shallow copy, a copy of the variable pointer, and a shallow copy by default .

There are some special uses:

// The Getter method was renamed Isfinished@property (readonly, getter=isfinished) BOOL finished;
// when the Getter/setter method is automatically generated, the variable is renamed to _myfinished @synthesize finished = _myfinished;

Ios-properties Getting Started

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.