During iOS development, it is possible to use constants on multiple pages, such as the coordinates of a control, the fixed spacing of controls, enumerations, and so on.
Below is a small way to define these constants in a specialized class (for later modification and management) and import the header file into the PCH file, which can be called anywhere, as follows:
1. Create a new class, Inherit from NSObject
2. Clear all the contents of. h and. M, note: keep #import <uikit/uikit.h> in two files , because sometimes you need to define some CGFloat constants
3. h files are some constant names beginning with Uikit_extern , and. m files assign values to constants
4. These constants are defined at this time, and then the class name of the class is copied to the PCH file to ensure that the value of the defined constant can be obtained directly from anywhere
5, this time in any controller, Model, view call these constants
a small partner in need can try to play -. -
Constants that can be used throughout the Xcode project