iOS about the difference between member variables and attributes

Source: Internet
Author: User

1. Attributes, including the Setter/getter method, can be used to get the attribute in dot syntax


2. The member variable has no Setter/getter method, dot syntax dot not come out


[email protected] compiler will automatically setter/getter method and member variable name of _ member variable


@systhesize the role of the keyword:


Let the compiler automatically generate the Setter/getter method for you


4. Specifying an instance variable for a property


If the member variable MYBTN is given the keyword @systhesize, the instance variable is mybtn, if not, it is _mybtn.


5. Member variables are used inside the class without the need for external contact variables.

6. Properties for external access to other classes

iOS about the difference between member variables and attributes

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.