(a) code specification pragma mark
1. Definition
The code at the beginning of the #pragma is a compiler directive, which is a program-or compiler-specific instruction. Not necessarily applicable to other compilers or other environments. If the compiler does not recognize the directive, it is ignored.
2. Role
At the top of the Editor pane, the methods and functions pop-up menu separates code, normalizes code, and facilitates reading lookups.
3. Use
Add #pragma mark where it needs to be annotated-
#pragma mark-When the view is going to be displayed-(void) Viewwillappear: (BOOL) animated{ //Initialize array of selected numbers/ * Empty the selected betting ball group each time it is switched to Rootview */ Datamodel *datamodel = [Datamodel sharedatasource]; Datamodel. Balls = [[Nsmutablearray alloc] init];}
(ii) Re-usable tool code Snippets
1. Definition
Collection of common code specifications, shortcut key output when needed
2. Role
Create and augment your code snippet library by creating reusable blocks that you can use quickly where you need them, and save on the actions and time you need to enter them.
3. Use
Let's create the pragma mark quick action that we just introduced
Create a new project and enter the #pragma mark–< #Title in the project at random. #>
Select all the text, press and hold the mouse to change the arrow, and drag into the Code snippet library
Create success, pull to the bottom of code snippet library, modify name and add shortcut action
At this point, we are free to enter PM in the class, and prompt input prompts will pop up.
Press ENTER, which is auto-complete
Plus, I've built more than three quick-action sets.
Title:nslog Completion Shortcut:log Completion scopes:function or Method NSLog (@ "< #Log #>");
Title:property Strong completion Shortcut:ps completion Scopes:all
Title:property Assign Completion SHORTCUT:PA completion Scopes:all
Check the Code snippet library, the original also has a lot of commonly used quick operations, such as If,ifelse,dowhile, etc.