iOS笔记之提高效率

1. XCode快捷键

使用CodeSnippets提高开发效率
CodeSnippets的备份
/Users/envylotus/Library/Developer/Xcode/UserData/CodeSnippets 拷出来放在不同的电脑上使用

强烈安利:在当前视图下按住optional点选左侧边栏的文件,就可以得到当前文件和点选文件的拆分视图了

cmd+0开关左边栏
cmd+option+0 开关右边栏
cmd+shift+0 打开API搜索

option + command + <— 收起注释
option + command + —> 展开注释

一定要用#pragma - mark - 分割各类方法
swift中是//MARK: -

多用点cmd+F
command + [ 代码左移:
command + ] 代码右移

option + command +[ 代码上移
option + command +] 代码下移

在终端里打say geek 可以读出来
选中单词右键查找可以出来字典
cmd+{}左右缩进
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+/ 可以加注释

你可能感兴趣的:(iOS笔记之提高效率)