-
Notifications
You must be signed in to change notification settings - Fork 0
/
CodeSnippet.m
142 lines (111 loc) · 2.71 KB
/
CodeSnippet.m
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//
// CodeSnippet.m
// LEO
//
// Created by Leo on 2017/10/17.
// Copyright © 2017 Leo. All rights reserved.
//
/**
* myAssign
* myStrong
* myCopy
* myWeak
* myDelegate
*/
@property (nonatomic, assign) <#type#> <#name#>;
@property (nonatomic, strong) <#type#> *<#name#>;
@property (nonatomic, copy) NSString *<#name#>;
@property (nonatomic, weak) <#type#> *<#name#>;
@property (nonatomic, weak) id<<#delegate#>> delegate;
/**
* myInitWithFrame
*/
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
<#statements#>
}
return self;
}
/**
* myInit
*/
- (instancetype)init {
if (self = [super init]) {
<#statements#>
}
return self;
}
/**
* myInterface
*/
@interface <#name#> : <#type#>
@end
/**
* myExtension
*/
@interface <#name#> ()
@end
/**
* myImplementation
*/
@implementation <#name#>
@end
/**
* myProtocol
*/
@class <#type#>;
@protocol <#name#> <NSObject>
@optional
@end
/**
* myInstancetype
*/
+ (instancetype)<#name#>With<#property#>:(<#type#> *)<#property#>;
- (instancetype)initWith<#property#>:(<#type#> *)<#property#>;
/**
* mySharedInstance
*/
+ (instancetype)shared {
static <#type#> *_shared = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_shared = [[self alloc] init];
});
return _shared;
}
/**
* myLabel
*/
VNiLabel *<#label#> = [[VNiLabel alloc] initWithFrame:CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>)];
<#label#>.font = kFont<#Size#>;
<#label#>.text = @"<#text#>";
<#label#>.textColor = kColor_<#color#>;
<#label#>.textAlignment = NSTextAlignmentCenter;
[<#superView#> addSubview:<#label#>];
/**
* myImageView
*/
VNiImageView *<#imageView#> = [[VNiImageView alloc] initWithFrame:CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>)];
<#imageView#>.image = [UIImage imageNamed:@"<#name#>"];
[<#superView#> addSubview:<#imageView#>];
/**
* myButton
*/
VNiButton *<#button#> = [[VNiButton alloc] initWithFrame:CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>)];
<#button#>.titleLabel.font = kFont<#Size#>;
[<#button#> setTitle:@"<#title#>" forState:UIControlStateNormal];
[<#button#> setImage:[UIImage imageNamed:@"<#name#>"] forState:UIControlStateNormal];
[<#button#> addTarget:self action:@selector(<#selector#>) forControlEvents:UIControlEventTouchUpInside];
[<#superView#> addSubview:<#button#>];
/**
* myView
*/
VNiView *<#view#> = [[VNiView alloc] initWithFrame:CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>)];
[<#superView#> addSubview:<#view#>];
/**
* myServerQuestion
*/
/**
* SERVER_Q
* <#Question#>
*/