iOS Development UI Chapter-ios some tips for using Xcode in development

Source: Internet
Author: User

iOS Development UI Chapter-ios some tips for using Xcode in development

First, the use of shortcut keys

The following shortcut keys are commonly used:

New

Shift + CMD + N New Project

CMD + N New file

View

Option + cmd + ENTER to open assistant editor

CMD + return display main window

cmd + 0 Navigation window

Option + cmd + 0 tool window

Switch between. M & H control + cmd + up/Down

Switch between control + cmd and around in the order of the Browse files

View header file Control + cmd + j

Switch to the corresponding function control + 6 support smart Input, note input method

Run

CMD + R Run

CMD +. Stop it

CMD + b Compilation

CMD + SHIFT + B static memory analysis compilation to check for memory leaks on the program structure

Typesetting

Control + I re-indent the selected button

CMD +] Increase indent to the right

CMD + [Decrease Indent to the left]

CMD +/comment/uncomment, hint: When uncomment is canceled, the comment double slash must be at the beginning of the line

cmd + up to file start position

CMD + down to file end position

Second, OC Proprietary annotations

annotation forms and effects

(1) #pragma mark notes

(2) #pragma mark-notes

Third, the use of warning (note)

form of Use:

#warning code's not finished.

can help us to quickly locate the code

Iv. use of code blocks

For frequently used blocks of code, you can save it as a block of code and set the prompt for fast encoding.

Make appropriate edits to a block of code

Use < #name #> and < #type #> to keep blocks of code from being "written dead";

After setting the prompt effect:

Five, print content view (rewrite description method of skill)

code example:

1 -(NSString *) description2{3     //  contains the object type name, and the object's pointer address  4     return [nsstring stringWithFormat:@ "<%@:%p> {answer:%@, title :%@, Icon:%@, Options:%@}"class", Self, self.answer, Self.title, Self.icon, Self.options]; 5 }

Tips:

If you want to trace the details of an object at development time, you can override the description method, similar to the Java ToString ()

Add an extension to the root class

1 #import "nsarray+log.h"2 3 @implementationNsarray (Log)4 5-(NSString *) Descriptionwithlocale: (ID) Locale6 {7     //iterates through all the contents of the array, stitching the contents into a new string to return8nsmutablestring *STRM = [nsmutablestringstring];9     Ten[StrM appendString:@"(\ n"]; One      A     //iterate through the array, self is the current array -      for(IDObjinchSelf ) { -         //when stitching a string, the description method of obj is called the[StrM AppendFormat:@"\t%@,\n", obj]; -     } -[StrM appendString:@")"]; -     returnStrM; + } -  + @end
View Code

iOS Development UI Chapter-ios some tips for using Xcode in development

Related Article

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.