[Reading Notes] iOS-features, Reading Notes ios-

Source: Internet
Author: User

[Reading Notes] iOS-features, Reading Notes ios-

1. The @ symbol indicates "you will use the special usage of Objective-C ". @ Property is a new compiler function that declares a new object property.

 

2. @ property pre-compiled commands are used to automatically declare the setter and getter methods of attributes. In fact, attribute names do not have to be the same as instance variables, but they are the same in most cases.

 

3. When performing common operations on Object Attributes, you can use features to reduce the number of code to be written. The @ property pre-compiled command can be used to notify the compiler: "This object has this type of name property". Using this command, you can also pass some features (such as its variability: read-only or read/write) and Object Memory Management (retain, assign or copy) information. In addition, the compiler can automatically generate a method declaration for the setter and getter attributes of the object.

Use the @ synthesize pre-compiled command to notify the compiler to generate the accessors method. You can also control which instance variables the access method generated by the compiler takes effect. If you do not want to use the default behavior provided by Apple, you can write your own accessors.

Although the dot notation usually appears in the context of a feature, it is only a shortcut to call the setter and getter methods on the diagonal corner. For example, dealie. blah = greeble is equivalent to [dealie setBlah: greeble], while shronk = dealie. greeble is equivalent to shronk = [dealie greeble]. The dot notation reduces the number of characters to be typed and further facilitates programmers who have used other languages.

 

References: Objective-C basic tutorial

 

 

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.