[Basic iOS control and basic ios Control
A. Common files in the project1. unit test Test1 # define A 12 # define B 2 B. global import # import
1 # import "myhead. h"
C. Only allow the. m Files in all OC projects to import the foundation and UIKit LibrariesPrevent introduction of errors in other languages (such as C)
1 # ifdef _ OBJC__2 3 # import <Foundation/Foundation. h> 4 # import <UIKit/UIKit. h> 5 6 # endif
D. debug NSLog OptimizationThe system configures a DEBUG Macro during debugging.
1 # ifdef _ OBJC _ 2 3 # import <Foundation/Foundation. h> 4 # import <UIKit/UIKit. h> 5 6 # ifdef DEBUG 7 # define MyNSLog (...) NSLog (_ VA_ARGS _) 8 # else 9 # define MyNSLog (...) 10 # endif11 12 # endif
Note that "_ VA_ARGS _" is followed by two underscores. Use the MyNSLog function to print the test information. After the app completes the release version, MyNSLog will automatically fail.
1 MyNSLog (@ "test % d-% d", A, B );
Out:
13:22:33. 888 DatePicker [20702: 1696549]
Test
1-2