美文网首页
Xcode使用技巧

Xcode使用技巧

作者: 水止云起 | 来源:发表于2016-03-16 16:37 被阅读27次

Xcode Overview

简记
  • Command 控制导航区
  • Control 控制编辑区
  • Alt 控制右侧工具区
导航区

Command 1-8 跳转导航区不同的导航栏
Command 0 显示或隐藏导航区
Command+Shift+J 显示项目导航栏并选中当前文件

工具区

Alt+Command 1-6 跳转工具区不同的检测器
Alt+Command+Control 1-4 跳转工具区不同的库
Alt+Command 0 显示或隐藏工作区

编辑区

Control+1 标准编辑模式显示相关文件列表
Control+2 标准编辑模式显示历史列表
Control+4 标准编辑模式显示顶级目录列表
Control+5 标准编辑模式显示同Group下文件列表
Control+6 标准编辑模式显示文件内容列表。文件内容较多时,可快速导航属性列表、方法列表等
Command+J 将光标切回到编辑区
Command+Enter 切换到标准编辑模式
Command+Alt+Enter 切换到辅助编辑模式
Command+Shift+Alt+Enter 切换到版本编辑模式
Control+Command+方向左 显示历史记录的前一个文件
Control+Command+方向右 显示历史记录的后一个文件
Control+Command+方向上或下 切换显示头文件和实现文件
Command+方向左 将光标移到当前行的最前
Command+方向右 将光标移到当前行的最后
Alt+方向左 将光标移到当前词的最前
Alt+方向右 将光标移到当前词的最后
Command+\ 增加或删除当前行的断点

其他

Command+Shift+Y 显示或隐藏调试区
Command+Shift+O 快速搜索浏览文件、类、算法以及函数等
Command+Shift+0 打开文档
Command+W 关闭窗口

增加自定义代码片段

增加自定义代码片段的方法

代码块文件保存位置

~/Library/Developer/Xcode/UserData/CodeSnippets

常用代码块(快捷提示)

Custom Objective-C Mark(pm)

#pragma mark - <#mark#>

Custom Objective-C Mark Override(pmoverride)

#pragma mark - Override

Custom Objective-C Mark Public Methods(pmpublic)

#pragma mark - Public

Custom Objective-C Mark Private Methods(pmprivate)

#pragma mark - Private

Custom Objective-C Mark Responder(pmresponder)

#pragma mark - Responder

Custom Objective-C Mark Setter(pmsetter)

#pragma mark - Setter

Custom Objective-C Mark Getter(pmgetter)

#pragma mark - Getter

Custom Objective-C Property Default(prodefault)

@property (nonatomic) <#Type#> <#variable#>;

Custom Objective-C Property Delegate(prodelegate)

@property (nonatomic,weak) id<<#protocol#>> delegate;

Custom Objective-C Property IBOutlet(proiboutlet)

@property (nonatomic, weak) IBOutlet <#UIView#> *<#view#>;

Custom Objective-C Property Weak(proweak)

@property (nonatomic, weak) <#Class#> *<#varible#>;

Custom Objective-C Property Copy(procopy)

@property (nonatomic, copy) <#Class#> *<#varible#>;

Custom Objective-C Log Method Name(lmn)

NSLog(@"%@", NSStringFromSelector(_cmd));

Custom Objective-C Log Object(log)

NSLog(@"%@", <#object#>);

Custom Objective-C Init(init)

- (instancetype)init {
    if (self = [super init]) {
        <#statements#>
    }

    return self;
}

Custom Objective-C Shared Instance(sharedInstance)

+ (instancetype)sharedInstance {
    static <#Class#> *sharedInstance;
    static dispatch_once_t onceToken;

    dispatch_once(&onceToken, ^{
        sharedInstance = [[<#Class#> alloc] init];
    });

    return sharedInstance;
}

Custom Objective-C Init View(initview)

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self initialize];
    }
    
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    if (self = [super initWithCoder:aDecoder]) {
        [self initialize];
    }
    
    return self;
}

- (void)initialize {

}

相关文章

网友评论

      本文标题:Xcode使用技巧

      本文链接:https://www.haomeiwen.com/subject/eswqlttx.html