PCH files in IOS development, and what is commonly used by PCH

Source: Internet
Author: User

First, create the PCH file. Click Command+n. such as Operation

Naming conventions are generally: project name-prefix

Step Two

OK, you have finished making the PCH file here. Then you can use it.

PCH files generally write data that can be used globally.

Like what:

The width and color of the screen (no punctuation behind the macro)

#define RGB (r,g,b,a)   [Uicolor colorwithred: (r/255.0) Green: (g/255.0) Blue: (b/255.0) Alpha: (a)] #define SCREEN_W [ UIScreen mainscreen].bounds.size.width#define Screen_h [UIScreen mainscreen].bounds.size.height

Of course, there are more lines of macros. Multi-line macros are written with backslashes at the end of each line.

#define DLSTOREUSERID (name, key) nsuserdefaults *defaults = [Nsuserdefaults standarduserdefaults]; [Defaults setobject: (NSString *) name Forkey: (NSString *) key]; [Defaults synchronize]\

PCH files in IOS development, and what is commonly used by PCH

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.