iOS Xcode自定义代码块以及迁移
2013 年 12 月 14 日
文中将要介绍以下四点内容
-
代码块的意义
-
自定义代码块入口
-
代码块迁移
-
代码块的编写
一 . 意义在于节约时间成本
like
我在编译器键入 strong, 回车
自动生成@property (nonatomic, strong) *;
二 . 如何自定义代码块
-
如下图所示 选中一行代码右键 crate code snippet
-
右上角方框快速进入
下图填入描述, 以及快捷方式
三 . iOS Xcode自定义代码块迁移
-
Command + Shift + G. 前往如下路径的文件夹
-
路径 : ~/Library/Developer/Xcode/UserData/CodeSnippets
-
把文件夹内部的文件复制, 粘贴到另一台电脑的Xcode同样的文件夹中即可
-
重启xcode
四 . 代码块编写
下面我举个栗子 . 0.O
- (UITableView *) { if(!) { = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain]; .delegate =self; .dataSource =self; [ registerClass:[ class] forCellReuseIdentifier:@"cellIdentifier"];} return ;}#pragma mark - tableView delegate- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { *cell = [tableView dequeueReusableCellWithIdentifier:@"cellIdentifier"]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { }
注: 即为可以替换的词语.
我再举个栗子
@property (nonatomic, assign) ;
总结
-
留作备忘
-
给需要的人
完~
编者 : 夏天然后
作者:夏天然后
链接:https://www.jianshu.com/p/a901cd3f8139