前言
文中将要介绍以下四点内容
下面话不多说了,来一起看看详细的介绍吧
一 . 意义在于节约时间成本
如下图所示 选中一行代码右键 crate code snippet
右上角方框快速进入
图1
下图填入描述,以及快捷方式
图2
- Command + Shift + G. 前往如下路径的文件夹
- 路径 : ~/Library/Developer/Xcode/UserData/CodeSnippets
- 把文件夹内部的文件复制,粘贴到另一台电脑的Xcode同样的文件夹中即可
- 重启xcode
四 . 代码块编写
下面我举个栗子 . 0.O
- - (UITableView *)<#tableview#> {
- if(!<#tableview#>) {
- <#tableview#> = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
- <#tableview#>.delegate =self;
- <#tableview#>.dataSource =self;
- [<#tableview#> registerClass:[<#cell#> class] forCellReuseIdentifier:@"cellIdentifier"];
- }
- return <#tableview#>;
- }
- #pragma mark - tableView delegate
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return <#expression#>
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return <#expression#>
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- <#UITableViewCell#> *cell = [tableView dequeueReusableCellWithIdentifier:@"cellIdentifier"];
- return cell;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- }
注: <#class#>
即为可以替换的词语.
我再举个栗子
- @property (nonatomic,assign) <#Class#> <#object#>;
总结
留作备忘
给需要的人