What does "iOS development" #pragma mark mean?

Source: Internet
Author: User

The following code directives are often seen in the code inside the Xcode IDE:

#pragma mark-
#pragma mark Initialization

What's #pragma?

Technically, the code that starts with #pragma is a compiler directive, which is a program-or compiler-specific instruction. They do not necessarily apply to other compilers or other environments. If the compiler does not recognize the directive, it is ignored.

Role

They tell the Xcode compiler to separate the code in the methods and functions pop-up menus at the top of the Editor pane, as shown in:

Some classes, especially some controller classes, can be long, and methods and function pop-up menus facilitate code navigation. Joining the #pragma directive at this point is very effective in logically organizing your code.

Attention
  1. There must be no space behind the "-" #pragma mark–.
  2. If your logo does not appear in the pop-up menu, such as if no divider appears, on the Xcode menu "Preferences ..." The "Code sense" option in the check box uncheck "Sort list Alphabetically".

What does "iOS development" #pragma mark mean?

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.