I. Document structure Management
1. Create A libraries folder where all third-party libraries are placed.
2. Create the Utilities folder, and put the self-encapsulated class into it.
3. CreateA C onstants.h header file, where all constants are defined. The Constants.h file is placed inside the main filegroup.
4. Each function block is put into a group to establish the actual folder management in the directory.
5. The program resource file is placed in the supporting Files folder. such as . plist, database data, etc.
6. Create an image, music, video and other related folders under the supporting Files folder. Images, audio, video, and other resources are placed in them .
7. Picture resources to the program logical framework to establish the corresponding Entity folder management, if more than one function block shared, set up Common folder, put it.
Second, coding specifications
Note: In order not to affect reading, the code lines of a class should not exceed 300 lines; One method should try not to exceed 30 rows. There are more than one way to break down when refactoring.
1. at the beginning of each. h file, describe the functional logic of the class in short text.
2. when introducing other classes, to be introduced as instance variables in . h. Otherwise, it is introduced in . M.
[email protected] and a blank line between @implementation and #import. @synthesize followed by @implementation writing.
4.a: Declaring instance variables are declared as attributes.
B: The instance variables and methods to be accessed by other classes are declared in the. h file, otherwise declared in the . M file.
C: instance variables and methods are put together with function blocks to implement a function that is put together consecutively, and the other function's empty line begins to declare.
D: The instance variable starts immediately after the @interface , and the method begins with an empty line after the instance variable.
E: each function block can be simply explained, the single instance variable method can not be described, the key or special variables or methods are described separately. Note is released on a row of the variable declaration.
5. The first function module in the class is separated by #pragma mark- two lines above, and an empty line.
6.NSLog is removed after the test is complete.
7. add a suffix when declaring an instance variable for a system's common class:
Uiviewcontroller:vc
Uiimage:img Uiimageview:imgview Uiview:view Uilabel:lbl
UIBUTTON:BTN Uinavigationbar:nbar Uitoolbar:tbar Uisearchbar:sbar
Uitextfield:textfield Uitextview:textview
Nsarray:array Nsmutablearray:marray
Nsdictionary:dict nsmutabledictionary:mdict
Nsstring:str Nsmutablestring:mstr
Nsset:set Nsmutableset:mset
8. The variables, method names in the program as far as possible literal meaning function, for the need to use comments to explain the part of the code, comments are expressed in the following format:
/**
* Method or Variable description
* @param parameter 1 description (for method)
* @param parameter 2 description (for method)
* @return The return value is described if the method has a return value
*/