Xcode-Code-Mark Of OC
簡介
本文列舉了以下代碼塊
- Mark Section Title
- Mark ChildNode Of Section
- Singleton Instance
- Standardize Structure Of Code (VC)
- Standardize Structure Of Code (View)
- Standardize Structure Of Code (Object)
如有問題辉浦,歡迎到GitHub上提出Issue。
以下開始干貨:
Mark Section Title
Title |
Mark Section Title |
Summary |
內(nèi)容標(biāo)記 |
Completion Shortcut |
Mark Section Title |
#pragma mark - <#Section Title #>
Mark ChildNode Of Section
Title |
Mark ChildNode Of Section |
Summary |
標(biāo)記章節(jié)的子節(jié)點 |
Completion Shortcut |
Mark ChildNode Of Section |
#pragma mark └ <#ChildNode#>
Singleton Instance
Title |
Singleton Instance |
Summary |
單例 |
Completion Shortcut |
Singleton Instance |
+ (instancetype)sharedInstance {
static dispatch_once_t pred;
__strong static id instance = nil;
dispatch_once( &pred, ^{
instance = [[self alloc] init];
});
return instance;
}
Standardize Structure Of Code (VC)
Title |
Standardize Structure Of Code (VC) |
Summary |
VC 代碼結(jié)構(gòu) |
Completion Shortcut |
Structure VC |
#pragma mark - LifeCycle 生命周期
#pragma mark └ Dealloc
- (void)dealloc {
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark └ Init
- (instancetype)init {
if(self = [super init]) {
}
return self;
}
#pragma mark └ Content View Loading
- (void)viewDidLoad {
[super viewDidLoad];
[self setupContentViews];
[self fetchContentData];
[self setExtentdedLayoutEdgeZero];
}
/**
* 初始化界面并設(shè)置布局
*/
- (void)setupContentViews {
[self layoutPageSubViews];
}
/**
* 設(shè)置布局
*/
- (void)layoutPageSubViews {
}
/**
* 獲取數(shù)據(jù)并繪制界面
*/
- (void)fetchContentData {
[self renderContentViews];
}
/**
* 繪制界面
*/
- (void)renderContentViews {
}
/**
* 設(shè)置頂部導(dǎo)航欄拓展布局為空
*/
- (void)setExtentdedLayoutEdgeZero {
if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) {
self.edgesForExtendedLayout = UIRectEdgeNone;
}
}
#pragma mark - Event Response 事件響應(yīng)
#pragma mark - Delegate Realization 委托方法
#pragma mark - Custom Method 自定義方法
#pragma mark └ Other
#pragma mark - Custom Accessors 自定義屬性
Standardize Structure Of Code (View)
Title |
Standardize Structure Of Code (View) |
Summary |
View 代碼結(jié)構(gòu) |
Completion Shortcut |
Structure View |
#pragma mark - + 靜態(tài)方法
+ (instancetype)view {
id view = [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil].firstObject;
return view;
}
#pragma mark - Overridden Methods
#pragma mark └ Dealloc
- (void)dealloc { }
#pragma mark └ LifeCycle 生命周期
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self commonInit];
}
return self;
}
- (void)awakeFromNib {
[super awakeFromNib];
[self commonInit];
}
- (void)commonInit {
}
#pragma mark - Private Method 自定義方法
#pragma mark - Event Response 事件響應(yīng)
#pragma mark - Delegate Realization 委托實現(xiàn)
#pragma mark - Helper Method 幫助方法
#pragma mark - Custom Accessors 自定義屬性
Standardize Structure Of Code (Object)
Title |
Standardize Structure Of Code (Object) |
Summary |
Object 代碼結(jié)構(gòu) |
Completion Shortcut |
Structure Object |
#pragma mark - LifeCycle 生命周期
#pragma mark └ Dealloc
- (void)dealloc {
}
#pragma mark └ Init
- (instancetype)init {
if(self = [super init]) {
}
return self;
}
#pragma mark - Event Response 事件響應(yīng)
#pragma mark - Delegate Realization 委托方法
#pragma mark - Custom Method 自定義方法
#pragma mark └ Other
#pragma mark - Custom Accessors 自定義屬性
持續(xù)更新中...
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者