IOS development-common Xcode shortcuts

Source: Internet
Author: User

IOS development-common Xcode shortcuts


Among all the shortcuts in Xcode 6, the following should be learned first. After you learn how to use them, you may not need them anymore.

Xcode navigation shortcut

1. Project Navigator: Command + 1

Allows you to quickly browse code, images, and user interface files.


2. Display/hide the navigator panel: Command + 0

When you are on the screen, you may want to hide the content that has nothing to do with the content you are interested in. This shortcut is useful if you want to use a secondary editor or design a user interface and connect it to the code.


3. Display/hide Utility panel: Command + Option + 0

The Utility panel is used to hide a user interface file when you only consider writing code. <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD48cD48aW1nIHNyYz0 = "http://www.2cto.com/uploadfile/Collfiles/20150110/2015011009035772.png" alt = "\"/>

4. open the file in the auxiliary Editor: select the file in the project navigator and execute the Option + left-click operation.

You can quickly open the Assistant Editor by pressing the Option key and clicking the file you want to open on the right of the current editing box.


Xcode search shortcut

When you are typing code, you suddenly want to add a function or modify a Bug. Of course, the fastest way is to use search. You can directly jump to a specific code segment without having to traverse a hundred lines of code with a scroll wheel.

5. Find Navigator: Command + Shift + F

You can use project search to find the number of times a variable or method name is mentioned. It can be matched based on the instance and can ignore uppercase and lowercase letters. You can also replace the variable name.


6. file navigation bar: Control + 6 (type method/variable name + Enter)

Jump to the code line in the current Code file. If the file contains thousands of lines of code, you can use this shortcut to narrow the search scope and insert the code as needed to add new functions.


7. Quick Start: Command + Shift + O

People who like the keyboard but do not like the mouse will love this shortcut and can jump directly to a method definition or specified code file.


8. Jump to the bar and quickly open the search input shortcut

Enter the first letter to quickly switch to a file or find a specific line of code. For example, in the ViewController. Swift file, press Command + Shift + O and type vDL. The first result displayed is

ViewDidLoad () Name function.

Enter the first letter to search for more information with less input.


9. fast switching between. h and. m files in the Program (written in Objective-C or C ++): Control + Command + Up Arrow

If you use Objective-C and C ++ to write programs, or open source code written in other languages, you may need to find the existing code. You can use the "Control + Command + Up Arrow" combination key to quickly switch between two related files, such as header files and implementation files in Objective-C. If you use Swift to write code, this is a bit inappropriate, because Swift uses a single code file.

Application compilation and cleanup

You must run it before experiencing a new application, but sometimes Xcode is not very powerful and cannot run your project well. In this case, you need to clear projects that cannot be run.

The following shortcut keys can help you use as few mouse clicks as possible during code writing.

10. Run the app: Command + R

During code writing, I usually use this shortcut key to run the application freely. Test the application as much as possible so that you can locate and fix bugs in the application early on.


11. Clear the project: Command + Shift + K

Maybe there is a problem with Xcode running, or the application cannot respond, or unexpected, you first want to clear the project and run it again. If the problem persists, disable Xcode.

. If the application cannot run, check if there are any error messages. You can take advantage of Googler for help. However, this method is not too frequent, and it will reduce the development speed of the program. It will remove all intermediate files and it will take time to recreate them.

Clear Xcode project when running fails


12. Build an application: Command + B

Check the code you write to ensure that it works normally. Compiling an app project allows you to determine whether it works properly before writing the next feature. Even if Xcode is soon checked after code writing, it may also be delayed or provide some inappropriate error prompts. You don't need to always run the application. If you just make some small changes, the compilation can help you do a quick check. In this way, you can return and add the next line of code.

Compile the Code to ensure that the application does not have any errors


Documentation and help

In the learning process, self-help learning is very important. For developers who have not browsed the Xcode documentation help, these shortcut keys can help to view the relevant code reference and better understand the code provided by Apple, to develop more robust apps.

13. documentation and reference: Command + Shift + 0 (Zero)

Xcode is used to install documents in the background and supports offline search and viewing. Open the document and reference, and enter a keyword in the Code. The Xcode document also provides some additional resources and sample projects.

Use the Documentation and Reference guide to learn how to use code


14. Quick help: Execute the Option + Left-click operation on the class or method name

Inline help helps developers quickly learn how to use classes or code snippets. Execute the Option + Left-click operation on the variable, class, or method name to obtain more details. If you click the reference link at the bottom of the pop-up view, you can easily jump to the document provided by Xcode. You can also execute Option + double-click on the variable, class, or method name to conveniently jump to the document.

Quick help when writing code

Other shortcut keys:

"Recently, commands + Shift + J shortcut operations are preferred to show the files you opened in the project navigator. I recently spent a lot of days on large code libraries. This key combination can be quickly redirected to the code library"

-Weendex

"I love CTRL + 1. This shortcut can open" Show Related Items 'pop-up menu '. If you have already placed the cursor in any method and click 'ctrl + 1', you can easily access all callers and callers of the method through the pop-up view. I often browse method callers to learn how to use this method ." -Skoll

"Cmd +. Conveniently pause running iOS Simulator"-weendex

"

I often use a shortcut operation that is not mentioned in this Article. Execute the 'COMMAND + Option + Shift + Left-click' operation on the file. This combination key can display a small pop-up view, you can view the places you want to open it, such as the auxiliary Editor, Tag, or window." -Cheezybob

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.