前言
文中將要介紹以下四點內容
下面話不多說了,來一起看看詳細的介紹吧
一 . 意義在于節約時間成本
1
2
3
4
|
like 我在編譯器鍵入 strong, 回車 自動生成 @property (nonatomic, strong) <# class #> *<#object#>; |
二 . 如何自定義代碼塊
如下圖所示 選中一行代碼右鍵 crate code snippet
右上角方框快速進入
圖1
下圖填入描述, 以及快捷方式
圖2
三 . ios xcode自定義代碼塊遷移
- command + shift + g. 前往如下路徑的文件夾
- 路徑 : ~/library/developer/xcode/userdata/codesnippets
- 把文件夾內部的文件復制, 粘貼到另一臺電腦的xcode同樣的文件夾中即可
- 重啟xcode
四 . 代碼塊編寫
下面我舉個栗子 . 0.o
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
- (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#>
即為可以替換的詞語.
我再舉個栗子
1
|
@property (nonatomic, assign) <# class #> <#object#>; |
總結
留作備忘
給需要的人
好了,以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對服務器之家的支持。
原文鏈接:https://www.jianshu.com/p/a901cd3f8139