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