Small white Study Development (IOS) oc_ @property parameters (2015-08-05)

Source: Internet
Author: User

//
Person.h
Manual memory Management
//
Created by admin on 15/8/5.
Copyright (c) 2015 admin. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Car.h"

@interface Person:nsobject
/*
The role of @property parameters

1. Generating declarations for set and get methods
2. Simple implementation of generating set and get methods
3. If you do not manually declare a relative member variable, a member variable that begins with _ is automatically generated
*/
/*
Types of @property parameters
1. Parameters related to the Set method memory management
Retain: Generating set methods that conform to memory management principles (applied to object types)
Assign: Direct assignment (applied to base data type, object type)
Copy

2. Multithreading-related
Nonatomic: Do not generate multithreaded, multithreaded management code (use this can be, more efficient)
Atomic: Generate multi-threaded, multi-threaded management code (this is the default, the development of Mac software more use this, the app is basically not used)

3. Do you want to generate the set and get methods
ReadWrite: Readable writable property, simultaneous generation of set and get methods
ReadOnly: Read-only property, generating only get methods

4. Parameters renamed by Set and Get methods
Setter: Sets the generated Set method name
Getter: Set the generated Get method name
*/
@property (Nonatomic,retain) Car *car;
@property (Nonatomic,retain) NSString *name;
@property (nonatomic,assign) int age;
@property (nonatomic,assign) float weight;
@property (nonatomic,assign,readonly) int idcard;

Changing the Set method name and get method name
@property (Nonatomic,assign,setter=shezhi:,getter=quzhi) BOOL isdied;

@end

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Small white Study Development (IOS) oc_ @property parameters (2015-08-05)

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.