iOS Basics-xcode tips for using

Source: Internet
Author: User

(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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.