OBJECTIVE-C study notes-third day (1)

Source: Internet
Author: User

Starting today with OC Write iOS program, encountered problems have

1. When different classes use the method of a class or access the properties of a class (public methods or properties), the method or property must be declared in the class header file.

2. The Declaration of the object type and the definition need to use *, indicating that this is a pointer to a piece of memory space. Basic types are not required.

The definition of the 3.init method requires a determination of whether the initialization succeeds (self is not empty).

4. #define can predefine a piece of text, which can be substituted with a predefined variable name when writing code.

5. When using different classes, be careful to import the header files.

6.for in is slightly different from Swift, the syntax is roughly for (type variable name in the collection to traverse) {}

7. Sentence at the end of the semicolon ... (Swift is accustomed to forgetting!) ), if to parentheses (), while to parentheses (), for brackets (), and switch to parentheses () ...

8.NSString format Output Nsinteger, it is best to convert the Nsinteger type to a long type, using%LD to format the output.

9. Categories can omit the name of the custom category (it is not clear what is different from the extension ...) Valid only in the current class? Or is it something else? The Viewcontroller used this ...

So far, the difference between @class and import is not clear. Perhaps import can know what property methods are in the class? @class don't know? Later to delve into ...

OBJECTIVE-C study notes-third day (1)

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.