In the multiplayer development process, the naming convention is very important, the unified naming convention is helpful for the coding readability, below share with you the name specification of iOS naming conventions and pictures and Chettu
iOS naming code
Small hump Nomenclature (CamelCase): The first lowercase letters begin with the initials of other words; large hump nomenclature (pascalcase): all initials.
Naming conventions:
1, class name, agreement name: Follow the big hump naming law;
2, constants: The constants here refer to macros (#define), enumerations (enum), constants (const), and so on, using lowercase "k" as a prefix, the name follows the big hump nomenclature.
3. Methods
* Method names and method parameters follow the same rules, using small hump method to start with lowercase;
* Method names and parameters as far as possible read like a word;
* Method name is not allowed to use "get" prefix;
*-or + to leave a space between the return type, but not the interval between the parameter list;
* If there are too many parameters, each parameter is recommended for one row;
Example:-(void) dosomethingwithstring: (NSString *) thestring (Nsinteger *) Theinteger {...} ; 4. Variable:
Class member variables, properties, local variables, small humps that start with lowercase, where class member variables add an underscore at the end of the name, such as: Mylovalvariable, Myinstancevariable_; the name of the variable name as far as possible can be inferred for its use, descriptive.
Writing specification:
1. When referencing the current class attribute in M file, use the Self.property method to distinguish the local variable, and use the "point" assignment when assigning the attribute, that is, a.property = value;
2. The work of using the import reference header file is all placed in the. h file, and the M file only keeps a reference to the current class header file;
3. If there are more methods in the M file, the method is grouped using #pragma mark notation for easy viewing;
Basically, the App's cut diagram can be divided into the following major categories:
Background, buttons, diagrams, pictures, photos, tabbar icon and so on.
In order for Chettu to be managed, it is usually named according to the nature of the picture. such as Bg-xxx.png, Btn-xxx.png, Img-xxx.png, Tab-xxx.png. When the image is to be used for the Retina screen, just add "@2x" to the file name. such as Bg-xxx@2x.png, Btn-xxx@2x.png, Icon-xxx@2x.png. Bg-xxx.png in the middle of the name-can be changed to _
Background
Bg-xxx.png, from the entire page of the large bottom, a tableview of the field, navigation bar of the bottom of the picture can be counted in the background range.
General (Normal): Btn-xxx-n.png, the most basic button appearance.
Click (highlight): Btn-xxx-h.png, the user touches the screen to touch the button, in order to inform the user to have clicked to appear the response prompt.
Can not click (disabled): Btn-xxx-d.png, on behalf of the app has this function but users can not use. For example, if the app has a phone call function installed on the ipod. Since it is not possible to be clicked, it is also true that it is simply hidden. To hide the button directly or to render it in a state that cannot be clicked depends on the situation.
Checked (selected): Btn-xxx-s.png, select when there are plural options, but usually do not take the button to do the plural option control, this button state of the opportunity is not high picture: Pic-xxx.png or Img-xxx.png.
Photo: Pho-xxx.png.
Tabbar on the icon approach is more special, although it is icon, but I will not be named Icon-xxx.png. In order to be separated from other icon, I will use Tab-xxx.png to express.
I hope you are skilled in using these, more harmonious coding.