Common settings such as xcode4-xcode4 theme style and shortcut keys

Source: Internet
Author: User

Start using xcode4 this evening. The first look is as follows.

1. Download and install xcode4


Because xcode4 and earlier versions need to coexist, select another installation path when installing xcode4. After the installation is successful, change the name of xcode under the xcode4 installation directory. the app is xcode4.app to differentiate the old version. Find an xcodeproj file, right-click get info, select xcode4 in open with, and click Change all to set file type association.

2. Familiar with the interface


Open xcode, and probably view the changes in the lower bound. Click here to see what it is, and view the xcode menu again.

If you are free, you can refer to the source code Management Section in the help document.

Create a helloworld project and operate on the IB link.

3. Configure the fonts and colors of the Code Editor)


I prefer to write code with a black background, and my eyes are quite comfortable. In the past, the old colortheme file was not used, and the storage path of colortheme changed ~ /Library/Application Support/xcode/color themes, xcode4 IN ~ /Library/developer/xcode/userdata/fontandcolorthemes, and the file format has changed, but most projects are the same. You can reconfigure the color font or manually modify the configuration file.

After Google, aktowns has written a conversion Script: https://gist.github.com/793006

The usage is very simple:

1. Download dvtcolorconvert. RB. If you put it on the desktop, copy the old theme file to the desktop.

// Dvtcolorconvert. Rb

 

#!/usr/bin/env ruby# This script converts xccolorthemes to dtvcolorthemes for porting xcode 3.x themes to xcode 4.x # created by ashley towns <ashleyis@me.com> # Public domain.# ./dvtcolorconvert <inputfile># spits out a .dtvcolortheme filerequire 'rubygems'require 'plist'raise "Error: need a source file #{__FILE__} " if ARGV.length == 0 def alpha inc, alpha=1  "#{inc} #{alpha}"enddef convert infile  hash = Plist::parse_xml infile  out_hash = {}  out_hash[:DVTSourceTextSyntaxFonts] = {}  out_hash[:DVTSourceTextSyntaxColors] = {}  hash.each do |name, node|    node.each do |child_name, child|      puts "[on] node:#{name} child:#{child_name}(#{child})"      if name == "Colors"        case child_name          when /Background/             out_hash[:DVTSourceTextBackground] = alpha child            out_hash[:DVTConsoleTextBackgroundColor] = alpha child            out_hash[:DVTSourceTextInvisiblesColor] = alpha child            out_hash[:DVTSourceTextBlockDimBackgroundColor] = alpha child          when /InsertionPoint/             out_hash[:DVTSourceTextInsertionPointColor] = alpha child            out_hash[:DVTConsoleTextInsertionPointColor] = alpha child            out_hash[:DVTDebuggerInsutrctionPointerColor] = alpha child            out_hash[:DVTConsoleDebuggerInputTextColor] = alpha child            out_hash[:DVTConsoleDebuggerOutputTextColor] = alpha child            out_hash[:DVTConsoleExectuableInputTextColor] = alpha child            out_hash[:DVTConsoleExecutableOutputTextColor] = alpha child          when /Selection/            out_hash[:DVTSourceTextSelectionColor] = alpha child            out_hash[:DVTConsoleTextSelectionColor] = alpha child            out_hash[:DVTDebuggerPromptTextColor] = alpha child          else            out_hash[:DVTSourceTextSyntaxColors][child_name] = alpha child        end      elsif name == "Fonts"        case child_name          when /xcode.syntax.plain/            child = "Inconsolata - 14pt"            out_hash[:DVTConsoleDebuggerInputTextFont] = child            out_hash[:DVTConsoleDebuggerOutputTextFont] = child            out_hash[:DVTConsoleDebuggerPromptTextFont] = child            out_hash[:DVTConsoleExecutableInputTextFont] = child            out_hash[:DVTConsoleExecutableOutputTextFont] = child            out_hash[:DVTSourceTextSyntaxFonts]['xcode.syntax.plain'] = child          else            out_hash[:DVTSourceTextSyntaxFonts][child_name] = "Inconsolata - 14pt" #child        end      else        raise "I don't know what #{name} is."      end    end  end  puts "Saving #{infile.gsub(/xccolortheme/,'dvtcolortheme')}"  fp = File.open(infile.gsub(/xccolortheme/,'dvtcolortheme'),'w')  fp.write out_hash.to_plist  fp.closeendconvert ARGV[0]#Dir['*.xccolortheme'].each do |file|#  convert file#end

2. Install "plist" Ruby GEM: $ sudo gem install plist

3. Execute the conversion: $ Ruby dvtcolorconvert. RB elfdart. xccolortheme is generated on the desktop ~ Restart xcode4 in/library/developer/xcode/userdata/fontandcolorthemes and enable the topic in fonts & colors in preferences.

The converted topic file:

 

If you like, you can download to: http://code.google.com/p/elf-ios-resource/downloads/detail? Name = elfdark. dvtcolortheme

Https://github.com/Sundae/Cocoa-Utilities

Iv. preferences/text editing

5. Shortcut Keys

Open key bindings preferences, copy default, and name it.

Keyboard Control: CTRL in the lower left corner of the keyboard, Ctrl, option, CMD (command, Apple spline) in sequence from left to right, Ctrl, shift, capslock, tab in sequence.

List format: Function name (shortcut key, such as "modify" for manual modification; otherwise, it is xcode4 default): Function Description

Edit menu:
Filter in Navigator (CMD + Option + J): file filtering (Search) in the lower left corner of xcode ).
Filter in Library (CMD + Option + l): library filtering (search), similar to the library of IB (CMD + Shift + l)
View menu:
Project (CMD + 1): switch to the project team in the navigation area on the left of xcode, similar to the previous Groups & files.
Show Navigator (CMD + 0): Show/hide the navigation area

Standard (CMD + enter): for example, switch to the Standard editor view in the "Editor" in the upper right corner, and the two on the right are assistant views (used to split the editor) version view (used to compare the version changes of the current file ).

Show debug area (modify cmd + Shift + r): Display/hide the debug area under xcode. Xcode4 combines the previous debugger with the handler. The default shortcut key is the shortcut key of the previous debugger (CMD + Shift + Y ), changed to the commonly used export led shortcut cmd + Shift + R, which facilitates calling out and hiding the debugging area. The R key is easier to press than the y key.

Navigate menu:

Reveal in project navigator (CMD + Shift + J): locate the project team in the navigation area and select the file being edited.

Jump to next counterpart (CTRL + cmd + up arrow): jump to the next related file, similar to the previous switch to Header/source file (CMD + Option + up arrow ), switch between the header file and the implemented file.

Editor:

Show completions (ESC or Ctrl + space): it should be the most commonly used function to display the automatic Completion list.

Re-indent (modify cmd + F8): organize code indentation (format the code style). This function is very common for me who like 8-bit tabs and neat code, it is difficult to change the habit of ALT + f8.

Comment selection (CMD +/): block comment

Fold (CMD + Option + left arrow): collapse the current block, adapt to methods, functions, and other curly brackets,/* Flower comments */, @ XX @ end, etc.

Unfold (CMD + Option + right arrow): expand the current block (if collapsed ).

Product menu:

Run (CMD + r): run directly.

Run (CMD + Option + r): run with the option.

Stop (modify cmd + Shift + enter): Stop running. It is used to xcode.

Step into (F7): One-Step follow-up

Step over (F6): skip one step

Step out (F8): One-Step Jump out

Clear Console (CMD + k): Clear the Console

Help Menu:

Quick help for selected item. you can open the header file by using the "h" icon.

Search documentation for selected text (CTRL + Option + cmd +, we recommend option + Click to enter the document window in quick help.

 

Selection:

Move to beginning of document (CMD + up arrow): move the cursor to the beginning of this document

Move to end of document (CMD + down arrow): move the cursor to the end of this document.

Text Key Binding:

Most of the operations on text are the same as those on Mac OS x. for Mac OS X character operations, quick Bi is more familiar with similar skills and can be used during character generation, you can also refer to my previous tutorials <learn more about xcode>.

Save the keybindings file in ~ Under/library/developer/xcode/userdata/keybindings, you can directly download and use the shortcut keys mentioned above to modify them:

Http://elf-ios-resource.googlecode.com/files/ElfKeyBinding.idekeybindings1.0.zip

Https://github.com/Sundae/Cocoa-Utilities

6. Offline documents

It seems that offline documents are not provided starting from xcode3. Apple's online documents are slow, making xcode downloads even worse... the solution is still the same: Let me talk about it in combination with xcode4:

1. Open xcode4 documentation preferences, select a library, click the info button below to view information, and find the feed address, for example:

Open the source in the browser and find the latest version of xar for download (the file is too large. If the download tool is not installed on the Mac, we recommend that you use thunder in Windows ).

Download the file to your local computer and decompress it with xar: sudo xar-XF file. xar

Obtain the document file .doc set"

Set the file owner to devdocs: sudo chown-r-p devdocs document file .doc set.

Make sure that xcode4 is not running. Copy the docset to the/xcode4 installation directory/platforms/iphoneos. Platform/developer/documentation/docsets/(you can directly click in the installed location ).

Run xcode4 to view documents offline.

VII. Locations preferences

Xcode4 puts all projects, workspace build, index, snapshots, and archives in a specific directory by default. The default value is ~ /Library/developer/xcode/deriveddata/

If you want to put the build directory under the project directory, set "build location" to "place build products in locations specified by tagets" here. Other locations are not recommended.

8. Updated in this article

1. Change the company name in the template that comes with xcode. 2011-05-10

Previously, xcode stored this information with COM. apple. in xcode configuration, the new xcode4 will read this information from the adress book of Mac OS X. To change the company name in the comment, you only need to open adress book. APP to change the companyName of the current login user name.

2. How to Use automatic insert to close curly braces}

In xcode preferences | text editing, select automatically insert closing "}", enter {in the code, and do not insert it immediately}. In this case, you only need to press enter to insert the right curly braces. Applicable and methods, if-Else, for, and so on.

3. Code function comments. 2011-05-10

// MARK: *** (TAG, with the same function # pragma mark ***),
// Todo :***
// Fixme :***
//!!! :***
//??? :***

4. Because Google Code is often in harmony in China, change the theme and keyboard file to GitHub:

Https://github.com/Sundae/Cocoa-Utilities

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.