[Xcode]自己常用的Code Snippets、Xcode插件、文件目录
2016-04-19 16:37
513 查看
目录
目录Code Snippets Xcode代码块
常用的Xcode插件
Xcode相关的文件目录
Code Snippets Xcode代码块
Code Snippets Library是Xcode中比较方便的管理代码块的功能,可以方便的用快捷方式敲出保存起来的代码,这里保存一下自己常用的Code Snippets,方便换机器或更新Xcode时取用。属性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;
关闭自动调整ScrollView的insets
if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)]) { self.automaticallyAdjustsScrollViewInsets = NO; }
配置cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *identifier = @"<#identifier#>"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; if (!cell) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } cell.textLabel.text = @"<#cell标题#>"; return cell; }
cel构造方法
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { } return self; }
cell自定义工厂方法
+ (instancetype)cellWithTableView:(UITableView *)tableView { static NSString * identifier = @"<#identifier#>"; <#customCell#> *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; if (!cell) { cell = [[<#customCell#> alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier]; //设置选中时的效果为None; cell.selectionStyle=UITableViewCellSelectionStyleNone; } return cell; }
回到主线程
dispatch_async(dispatch_get_main_queue(), ^{ });
新开一个异步线程
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ });
配置请求参数
NSMutableDictionary *params = [NSMutableDictionary dictionary]; params[@"<#parameter#>"] = @"<#value#>"; params[@"<#parameter#>"] = @"<#value#>"; params[@"<#parameter#>"] = @"<#value#>"; params[@"<#parameter#>"] = @"<#value#>";
NSLog宏
NSLog(FORMAT, ...) NSLog((@"%s[Line:%d]" FORMAT), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
常用的Xcode插件
自己常用的插件整理:安装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
VVDocumenter-Xcode - 文档注释插件
KSImageNamed-Xcode - imageNamed:图片拾取插件
OMColorSense - 直观颜色查看和调用调色盘取色插件
Peckham - 头文件导入插件Ctrl+Command+P
SCXcodeSwitchExpander - Switch自动展开枚举分支插件
XAlign - 代码对齐插件
HOStringSense - NSString字符串统计,输入自动转义插件
Xcode相关的文件目录
目录、UUID:主要是因为之前插件因为升级Xcode失效,需要读取Xcode的UUID导入到插件中描述文件目录:方便删除Xcode安装的无效描述文件
读取Xcode的UUID
defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID
打开Xcode插件目录
open ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/
Xcode描述文件目录
open ~/Library/MobileDevice/Provisioning\ Profiles
相关文章推荐
- mybatis错误java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- UML建模学习4:UML基本构造块之图
- 定义Foo() 函数,弹出对话框提示当前选中的是第几个单选框
- java简单的页面制作
- [Form Builder]APP_ITEM_PROPERTY.SET_PROPERTY 用法
- npy数据的保存与读取
- Linux笑我好蠢(1)
- 对struts2.0的学习
- require.js
- android ant 最简单的打包签名,混淆方法
- HDOJ(HDU) 1563 Find your present!(异或)
- MySQL实现类似Oracle的序列 - sequence
- SwipeRefreshLayout滑动冲突
- HDOJ(HDU) 1563 Find your present!(异或)
- TreeView详细用法
- 深度学习卷积神经网络大事件一览
- Leetcode 4. Median of Two Sorted Arrays
- 【Leetcode】9.Palindrome Number 解题
- iOS核心动画--浅析三个动画的实现
- Linux系统下常用的快捷键