A summary of some Xcode usage tips for IOS development _ios

Source: Internet
Author: User

One, the use of shortcut keys

The shortcut keys that you use frequently are as follows:
New

Shift + CMD + N New Project

CMD + N New file

View

Option + cmd + ENTER to open assistant editor

CMD + carriage return Display main window

cmd + 0 Navigation window

Option + cmd + 0 tool window

Switch Control + cmd + up/down between. M & H

Switch Control + cmd + around in order to browse files

View header file Control + cmd + j

Switch to the corresponding function control + 6 Support intelligent Input, note input method

Run

CMD + R Run

CMD +. Stop it

CMD + b Compilation

CMD + SHIFT + b static memory analysis compile to check the program structure for memory leaks

Typesetting

Control + I indents the selected button

CMD +] Increase indent to right

CMD + [to the left to reduce indentation

CMD +/comment/uncomment, hint: when uncomment, comment double slash must start at beginning

cmd + up to file start position

CMD + down to end of file position

Second, OC Proprietary notes

annotation form and effect

(1) #pragma mark notes

(2) #pragma mark-annotation

Iii. Use of warning (note)

Use form:

#warning code hasn't been written yet.

can help us to quickly locate the code

Four, the use of code block

For frequently used blocks of code, you can save it as a block of code and set up a prompt to encode it quickly.

Make appropriate edits to a block of code

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

The prompt effect after setting:

V. Print content view (tips for rewriting the description method)

code example:

Copy Code code as follows:

-(NSString *) description
{
Contains the object type name, and the pointer address of the object
return [NSString stringwithformat:@ "<%@:%p> {answer:%@, Title:%@, Icon:%@, Options:%@}", [Self class], self, SE Lf.answer, Self.title, Self.icon, self.options];
}


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

Copy Code code as follows:

#import "Nsarray+log.h"

@implementation Nsarray (Log)

-(NSString *) Descriptionwithlocale: (ID) locale
{
Iterate through all the contents of the array, stitching the content into a new string to return
nsmutablestring *STRM = [nsmutablestring string];

[Strm appendstring:@ "(\ n"];

Traversing an array, self is the current array
for (id obj in self) {
When the string is spliced, the description method of obj is invoked
[Strm appendformat:@ "\t%@,\n", obj];
}
[Strm appendstring:@ "]");
return STRM;
}

@end

Six, Plug-ins
here recommend two easy to use Xcode plug-ins

1, Plug-ins and use as follows:

(1). Two Plug-ins

Plugins that provide automatic hints for pictures in your project: Ksimagenamed-xcode-master

Provides quick-Create automatic annotations: Vvdocumenter-xcode-master

(2). Introduction to use:

(a) Use of ksimagenamed-xcode-master
When the plug-in is installed, the picture in the file is intelligently prompted.

(2) Vvdocumenter-xcode-master can provide quick annotation

You can provide comments in the following two formats based on your environment by knocking three slashes (that is,///) where you need to comment.

Comments in the first format:

Comment for the second format (before method):

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.