此篇博客尚不完整后续将会进行补充,如果你有更精彩的内容,请于下方评论!博主会予以补充!对您的评论博主感激不尽!
Code Snippets Xcode代码块
Code Snippets Library是Xcode中比较方便的管理代码块的功能,可以方便的用快捷方式敲出保存起来的代码,这里保存一下自己常用的Code Snippets,方便换机器或更新Xcode时取用。
1.属性Snippets
@property (strong, nonatomic) <#type#> *<#name#>;
@property (weak, nonatomic) <#type#> *<#name#>;
@property (assign, nonatomic) <#type#> <#name#>;
@property (copy, nonatomic) <#type#> *<#name#>;
@property (weak, nonatomic) id<<#delegate#>> delegate;
2.关闭自动调整ScrollView的insets
if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)]) {
self.automaticallyAdjustsScrollViewInsets = NO;
}
3.tableView
#pragma mark - tableViewDelegate,tableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return <#expression#>
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return <#expression#>
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = <#reuse#>;
<#Class#> *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[[<#Class#> alloc]initWithStyle:<#(UITableViewCellStyle)#> reuseIdentifier:cellIdentifier]autorelease];
}
return cell;
}
4.tableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
<#code#>
}
return self;
}
5.主线程
dispatch_async(dispatch_get_main_queue(), ^{
<#code#>
});
6.异步线程
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
<#code#>
});
附(常用插件、常用命令、常用路径)
1.常用插件
自己常用的插件整理:安装Alcatraz管理其他插件,在升级Xcode导致插件失效的时候能非常高效的重新安装整个插件列表
Alcatraz Package Manager - 管理插件的插件
命令行安装:
- 创建Xcode插件目录(不存在就创建)
mkdir -p ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins
- 从github下载Alcatraz
curl -fsSL https://raw.github.com/supermarin/Alcatraz/master/Scripts/install.sh | sh
- 创建Xcode插件目录(不存在就创建)
- VVDocumenter-Xcode - 文档注释插件
- KSImageNamed-Xcode - 图片拾取插件
- OMColorSense - 直观颜色查看和调用调色盘取色插件
- Peckham - 头文件导入插件Ctrl+Command+P
- SCXcodeSwitchExpander - Switch自动展开枚举分支插件
- XAlign - 代码对齐插件
- HOStringSense-for-Xcode - NSString字符串统计,输入自动转义插件
2.常用命令
- 读取Xcode的UUID
defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID
3.常用目录
- 打开Xcode插件目录
open ~/Library/Application/Support/Developer/Shared/Xcode/Plug-ins/
- Xcode描述文件目录
open ~/Library/MobileDevice/Provisioning/Profiles