在xcode中格式化代码

1. 安装homebrew

/usr/bin/ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"


2. 安装uncrustify

brew install uncrustify


3. 下载配置好的workflow包

http://by-igotit.com/wordpress/wp-content/uploads/2012/03/Uncrustify-Objective-C.workflow.tar.gz


4. 解压缩workflow包

mv Uncrustify-Objective-C.workflow.tar.gz ~/Library/Services/
cd ~/Library/Services/
tar zxvf Uncrustify-Objective-C.workflow.tar.gz


5. 下载针对Objective-C语言的Uncrustify配置文件

http://by-igotit.com/wordpress/wp-content/uploads/2012/03/uncrustify_obj_c.txt


6. 移动配置文件到用户主目录

mv uncrustify_obj_c.txt ~/.uncrustify_obj_c.cfg


7. 在keyboard shortcuts中配置快捷键command+shift+F

8. 在xcode中,全选code,使用快捷键格式化code,或者右键在services中uncrustify Objective-C

你可能感兴趣的:(手机开发)