Xcode learning document: Xcode4 theme Style

Source: Internet
Author: User

This article focuses on LearningXcodeTo learn and understandXcode4 topicThe details of the style operations are detailed, And the bonus is similar to the implementation of the whole process.Xcode4OfTopicStyle. For details, refer to the details in this article.

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.

 
 
  1. //dvtcolorconvert.rb  
  2.  
  3. #!/usr/bin/env ruby  
  4. # This script converts xccolorthemes to dtvcolorthemes for porting xcode 3.x themes to xcode 4.x   
  5. # created by ashley towns <ashleyis@me.com>   
  6. # Public domain.  
  7. # ./dvtcolorconvert <inputfile> 
  8. # spits out a .dtvcolortheme file  
  9.  
  10. require 'rubygems'  
  11. require 'plist'  
  12. raise "Error: need a source file #{__FILE__} [file.xccolortheme]" if ARGV.length == 0   
  13.  
  14. def alpha inc, alpha=1 
  15.   "#{inc} #{alpha}"  
  16. end  
  17. def convert infile  
  18.   hash = Plist::parse_xml infile  
  19.   out_hash = {}  
  20.   out_hash[:DVTSourceTextSyntaxFonts] = {}  
  21.   out_hash[:DVTSourceTextSyntaxColors] = {}  
  22.   hash.each do |name, node|  
  23.     node.each do |child_name, child|  
  24.       puts "[on] node:#{name} child:#{child_name}(#{child})"  
  25.       if name == "Colors"  
  26.         case child_name  
  27.           when /Background/   
  28.             out_hash[:DVTSourceTextBackground] = alpha child  
  29.             out_hash[:DVTConsoleTextBackgroundColor] = alpha child  
  30.             out_hash[:DVTSourceTextInvisiblesColor] = alpha child  
  31.             out_hash[:DVTSourceTextBlockDimBackgroundColor] = alpha child  
  32.           when /InsertionPoint/   
  33.             out_hash[:DVTSourceTextInsertionPointColor] = alpha child  
  34.             out_hash[:DVTConsoleTextInsertionPointColor] = alpha child  
  35.             out_hash[:DVTDebuggerInsutrctionPointerColor] = alpha child  
  36.             out_hash[:DVTConsoleDebuggerInputTextColor] = alpha child  
  37.             out_hash[:DVTConsoleDebuggerOutputTextColor] = alpha child  
  38.             out_hash[:DVTConsoleExectuableInputTextColor] = alpha child  
  39.             out_hash[:DVTConsoleExecutableOutputTextColor] = alpha child  
  40.           when /Selection/  
  41.             out_hash[:DVTSourceTextSelectionColor] = alpha child  
  42.             out_hash[:DVTConsoleTextSelectionColor] = alpha child  
  43.             out_hash[:DVTDebuggerPromptTextColor] = alpha child  
  44.           else  
  45.             out_hash[:DVTSourceTextSyntaxColors][child_name] = alpha child  
  46.         end  
  47.       elsif name == "Fonts"  
  48.         case child_name  
  49.           when /xcode.syntax.plain/  
  50.             child = "Inconsolata - 14pt" 
  51.             out_hash[:DVTConsoleDebuggerInputTextFont] = child  
  52.             out_hash[:DVTConsoleDebuggerOutputTextFont] = child  
  53.             out_hash[:DVTConsoleDebuggerPromptTextFont] = child  
  54.             out_hash[:DVTConsoleExecutableInputTextFont] = child  
  55.             out_hash[:DVTConsoleExecutableOutputTextFont] = child  
  56.             out_hash[:DVTSourceTextSyntaxFonts]['xcode.syntax.plain'] = child  
  57.           else  
  58.             out_hash[:DVTSourceTextSyntaxFonts][child_name] = "Inconsolata - 14pt" #child  
  59.         end  
  60.       else  
  61.         raise "I don't know what #{name} is."  
  62.       end  
  63.     end  
  64.   end  
  65.   puts "Saving #{infile.gsub(/xccolortheme/,'dvtcolortheme')}"  
  66.   fp = File.open(infile.gsub(/xccolortheme/,'dvtcolortheme'),'w')  
  67.   fp.write out_hash.to_plist  
  68.   fp.close  
  69. end  
  70.  
  71. convert ARGV[0]  
  72. #Dir['*.xccolortheme'].each do |file|  
  73. #  convert file  
  74. #end 

2. install "plist" ruby gem: $ sudo gem install plist

3. Execute conversion: $ ruby dvtcolorconvert. rb ElfDart. xccolortheme is generated on the desktop, and put it in ~ 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

4. Preferences/Text Editing)

 

Summary:XcodeLearning documents:Xcode4 topicThe style content has been introduced. I hope this article will help you!

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.