1. XCode快捷鍵
使用CodeSnippets提高開發(fā)效率
CodeSnippets的備份
將/Users/envylotus/Library/Developer/Xcode/UserData/CodeSnippets 拷出來放在不同的電腦上使用
強(qiáng)烈安利:在當(dāng)前視圖下按住optional點(diǎn)選左側(cè)邊欄的文件,就可以得到當(dāng)前文件和點(diǎn)選文件的拆分視圖了
cmd+0開關(guān)左邊欄
cmd+option+0 開關(guān)右邊欄
cmd+shift+0 打開API搜索
option + command + <— 收起注釋
option + command + —> 展開注釋
一定要用#pragma - mark - 分割各類方法
swift中是//MARK: -
多用點(diǎn)cmd+F
command + [ 代碼左移:
command + ] 代碼右移
option + command +[ 代碼上移
option + command +] 代碼下移
在終端里打say geek 可以讀出來
選中單詞右鍵查找可以出來字典
cmd+{}左右縮進(jìn)
command+shift+零,打開API
.m和.h切換
control + command + <— 或 control + command + —>;
向前向后選中代碼
shift + <— , shift + —>
查看xcode快捷鍵
xcode —> preference —>Key Bindings
command+Q退出ios模擬器
command+shift+H 模擬器home鍵
command+shift+HH
選中文件按enter重命名
前往要有/
command+shift+F搜索
CTRL+6可以搜索文件
command+shift+o,彈出搜索框,跳到指定文件,指定方法
ctrl+command+上箭頭
在h和m中迅速切換
option+左擊,看看quickhelp
利用enum提高代碼可讀性。代表上下左右的button
enum {
UP,
DOWN,
LEFT,
RIGHT
};
void touchButton(UIBtton button) {
switch (button.tag) {
case UP:
cout << "按下了向上的按鍵" << endl;
break;
case DOWN:
cout << "按下了向下的按鍵" << endl;
break;
case LEFT:
cout << "按下了向左的按鍵" << endl;
break;
case RIGHT:
cout << "按下了向右的按鍵" << endl;
break;
}
}
int main() {
UIBtton button1;
button1.tag = UP;
UIBtton button2;
button2.tag = DOWN;
UIBtton button3;
button3.tag = LEFT;
UIBtton button4;
button4.tag = RIGHT;
touchButton(button4);
return 0;
}
直接在那一行就可以cmd+/ 可以加注釋