@@ -53,10 +53,10 @@ @interface TYAlertView ()
53
53
@property (nonatomic , weak ) UILabel *titleLable;
54
54
@property (nonatomic , weak ) UILabel *messageLabel;
55
55
56
- @property (nonatomic , weak ) UIView *textFeildContentView ;
57
- @property (nonatomic , weak ) NSLayoutConstraint *textFeildTopConstraint ;
58
- @property (nonatomic , strong ) NSMutableArray *textFeilds ;
59
- @property (nonatomic , strong ) NSMutableArray *textFeildSeparateViews ;
56
+ @property (nonatomic , weak ) UIView *textFieldContentView ;
57
+ @property (nonatomic , weak ) NSLayoutConstraint *textFieldTopConstraint ;
58
+ @property (nonatomic , strong ) NSMutableArray *textFields ;
59
+ @property (nonatomic , strong ) NSMutableArray *textFieldSeparateViews ;
60
60
61
61
// button content View
62
62
@property (nonatomic , weak ) UIView *buttonContentView;
@@ -76,10 +76,10 @@ @interface TYAlertView ()
76
76
#define kButtonSpace 6
77
77
#define KButtonHeight 44
78
78
79
- #define kTextFeildOffset 10000
80
- #define kTextFeildHeight 29
81
- #define kTextFeildEdge 8
82
- #define KTextFeildBorderWidth 0.5
79
+ #define ktextFieldOffset 10000
80
+ #define ktextFieldHeight 29
81
+ #define ktextFieldEdge 8
82
+ #define KtextFieldBorderWidth 0.5
83
83
84
84
85
85
@implementation TYAlertView
@@ -136,10 +136,10 @@ - (void)configureProperty
136
136
_buttonCancleBgColor = [UIColor colorWithRed: 127 /255.0 green: 140 /255.0 blue: 141 /255.0 alpha: 1 ];
137
137
_buttonDestructiveBgColor = [UIColor colorWithRed: 231 /255.0 green: 76 /255.0 blue: 60 /255.0 alpha: 1 ];
138
138
139
- _textFeildHeight = kTextFeildHeight ;
140
- _textFeildEdge = kTextFeildEdge ;
141
- _textFeildorderWidth = KTextFeildBorderWidth ;
142
- _textFeildContentViewEdge = kContentViewEdge ;
139
+ _textFieldHeight = ktextFieldHeight ;
140
+ _textFieldEdge = ktextFieldEdge ;
141
+ _textFieldorderWidth = KtextFieldBorderWidth ;
142
+ _textFieldContentViewEdge = kContentViewEdge ;
143
143
144
144
_textFieldBorderColor = [UIColor colorWithRed: 203 /255.0 green: 203 /255.0 blue: 203 /255.0 alpha: 1 ];
145
145
_textFieldBackgroudColor = [UIColor whiteColor ];
@@ -172,9 +172,9 @@ - (void)addContentViews
172
172
[self addSubview: textContentView];
173
173
_textContentView = textContentView;
174
174
175
- UIView *textFeildContentView = [[UIView alloc ]init];
176
- [self addSubview: textFeildContentView ];
177
- _textFeildContentView = textFeildContentView ;
175
+ UIView *textFieldContentView = [[UIView alloc ]init];
176
+ [self addSubview: textFieldContentView ];
177
+ _textFieldContentView = textFieldContentView ;
178
178
179
179
UIView *buttonContentView = [[UIView alloc ]init];
180
180
buttonContentView.userInteractionEnabled = YES ;
@@ -233,41 +233,41 @@ - (void)addAction:(TYAlertAction *)action
233
233
[self layoutButtons ];
234
234
}
235
235
236
- - (void )addTextFieldWithConfigurationHandler : (void (^)(UITextField *textFeild ))configurationHandler
236
+ - (void )addTextFieldWithConfigurationHandler : (void (^)(UITextField *textField ))configurationHandler
237
237
{
238
- if (_textFeilds == nil ) {
239
- _textFeilds = [NSMutableArray array ];
238
+ if (_textFields == nil ) {
239
+ _textFields = [NSMutableArray array ];
240
240
}
241
241
242
242
UITextField *textField = [[UITextField alloc ]init];
243
- textField.tag = kTextFeildOffset + _textFeilds .count ;
243
+ textField.tag = ktextFieldOffset + _textFields .count ;
244
244
textField.font = _textFieldFont;
245
245
textField.translatesAutoresizingMaskIntoConstraints = NO ;
246
246
247
247
if (configurationHandler) {
248
248
configurationHandler (textField);
249
249
}
250
250
251
- [_textFeildContentView addSubview: textField];
252
- [_textFeilds addObject: textField];
251
+ [_textFieldContentView addSubview: textField];
252
+ [_textFields addObject: textField];
253
253
254
- if (_textFeilds .count > 1 ) {
255
- if (_textFeildSeparateViews == nil ) {
256
- _textFeildSeparateViews = [NSMutableArray array ];
254
+ if (_textFields .count > 1 ) {
255
+ if (_textFieldSeparateViews == nil ) {
256
+ _textFieldSeparateViews = [NSMutableArray array ];
257
257
}
258
258
UIView *separateView = [[UIView alloc ]init];
259
259
separateView.backgroundColor = _textFieldBorderColor;
260
260
separateView.translatesAutoresizingMaskIntoConstraints = NO ;
261
- [_textFeildContentView addSubview: separateView];
262
- [_textFeildSeparateViews addObject: separateView];
261
+ [_textFieldContentView addSubview: separateView];
262
+ [_textFieldSeparateViews addObject: separateView];
263
263
}
264
264
265
- [self layoutTextFeilds ];
265
+ [self layouttextFields ];
266
266
}
267
267
268
268
- (NSArray *)textFieldArray
269
269
{
270
- return _textFeilds ;
270
+ return _textFields ;
271
271
}
272
272
273
273
#pragma mark - layout contenview
@@ -287,16 +287,16 @@ - (void)layoutContentViews
287
287
288
288
[self addConstarintWithView: _textContentView topView: self leftView: self bottomView: nil rightView: self edageInset: UIEdgeInsetsMake (_contentViewSpace, _textLabelContentViewEdge, 0 , -_textLabelContentViewEdge)];
289
289
290
- // textFeildContentView
291
- _textFeildContentView .translatesAutoresizingMaskIntoConstraints = NO ;
292
- _textFeildTopConstraint = [self addConstarintWithTopView: _textContentView toBottomView: _textFeildContentView constarint: 0 ];
290
+ // textFieldContentView
291
+ _textFieldContentView .translatesAutoresizingMaskIntoConstraints = NO ;
292
+ _textFieldTopConstraint = [self addConstarintWithTopView: _textContentView toBottomView: _textFieldContentView constarint: 0 ];
293
293
294
- [self addConstarintWithView: _textFeildContentView topView: nil leftView: self bottomView: nil rightView: self edageInset: UIEdgeInsetsMake (0 , _textFeildContentViewEdge , 0 , -_textFeildContentViewEdge )];
294
+ [self addConstarintWithView: _textFieldContentView topView: nil leftView: self bottomView: nil rightView: self edageInset: UIEdgeInsetsMake (0 , _textFieldContentViewEdge , 0 , -_textFieldContentViewEdge )];
295
295
296
296
// buttonContentView
297
297
_buttonContentView.translatesAutoresizingMaskIntoConstraints = NO ;
298
298
299
- _buttonTopConstraint = [self addConstarintWithTopView: _textFeildContentView toBottomView: _buttonContentView constarint: 0 ];
299
+ _buttonTopConstraint = [self addConstarintWithTopView: _textFieldContentView toBottomView: _buttonContentView constarint: 0 ];
300
300
301
301
[self addConstarintWithView: _buttonContentView topView: nil leftView: self bottomView: self rightView: self edageInset: UIEdgeInsetsMake (0 , _buttonContentViewEdge, -_contentViewSpace, -_buttonContentViewEdge)];
302
302
}
@@ -350,33 +350,33 @@ - (void)layoutButtons
350
350
}
351
351
}
352
352
353
- - (void )layoutTextFeilds
353
+ - (void )layouttextFields
354
354
{
355
- UITextField *textFeild = _textFeilds .lastObject ;
355
+ UITextField *textField = _textFields .lastObject ;
356
356
357
- if (_textFeilds .count == 1 ) {
358
- // setup textFeildContentView
359
- _textFeildContentView .backgroundColor = _textFieldBackgroudColor;
360
- _textFeildContentView .layer .masksToBounds = YES ;
361
- _textFeildContentView .layer .cornerRadius = 4 ;
362
- _textFeildContentView .layer .borderWidth = _textFeildorderWidth ;
363
- _textFeildContentView .layer .borderColor = _textFieldBorderColor.CGColor ;
364
- _textFeildTopConstraint .constant = -_contentViewSpace;
365
- [_textFeildContentView addConstraintToView: textFeild edageInset: UIEdgeInsetsMake (_textFeildorderWidth, _textFeildEdge , -_textFeildorderWidth , -_textFeildEdge )];
366
- [textFeild addConstarintWidth: 0 height: _textFeildHeight ];
357
+ if (_textFields .count == 1 ) {
358
+ // setup textFieldContentView
359
+ _textFieldContentView .backgroundColor = _textFieldBackgroudColor;
360
+ _textFieldContentView .layer .masksToBounds = YES ;
361
+ _textFieldContentView .layer .cornerRadius = 4 ;
362
+ _textFieldContentView .layer .borderWidth = _textFieldorderWidth ;
363
+ _textFieldContentView .layer .borderColor = _textFieldBorderColor.CGColor ;
364
+ _textFieldTopConstraint .constant = -_contentViewSpace;
365
+ [_textFieldContentView addConstraintToView: textField edageInset: UIEdgeInsetsMake (_textFieldorderWidth, _textFieldEdge , -_textFieldorderWidth , -_textFieldEdge )];
366
+ [textField addConstarintWidth: 0 height: _textFieldHeight ];
367
367
}else {
368
- // textFeild
369
- UITextField *lastSecondTextFeild = _textFeilds[_textFeilds .count - 2 ];
370
- [_textFeildContentView removeConstraintWithView: lastSecondTextFeild attribte: NSLayoutAttributeBottom];
371
- [_textFeildContentView addConstarintWithTopView: lastSecondTextFeild toBottomView: textFeild constarint: _textFeildorderWidth ];
372
- [_textFeildContentView addConstarintWithView: textFeild topView: nil leftView: _textFeildContentView bottomView: _textFeildContentView rightView: _textFeildContentView edageInset: UIEdgeInsetsMake (0 , _textFeildEdge , -_textFeildorderWidth , -_textFeildEdge )];
373
- [_textFeildContentView addConstarintEqualWithView: textFeild widthToView: nil heightToView: lastSecondTextFeild ];
368
+ // textField
369
+ UITextField *lastSecondtextField = _textFields[_textFields .count - 2 ];
370
+ [_textFieldContentView removeConstraintWithView: lastSecondtextField attribte: NSLayoutAttributeBottom];
371
+ [_textFieldContentView addConstarintWithTopView: lastSecondtextField toBottomView: textField constarint: _textFieldorderWidth ];
372
+ [_textFieldContentView addConstarintWithView: textField topView: nil leftView: _textFieldContentView bottomView: _textFieldContentView rightView: _textFieldContentView edageInset: UIEdgeInsetsMake (0 , _textFieldEdge , -_textFieldorderWidth , -_textFieldEdge )];
373
+ [_textFieldContentView addConstarintEqualWithView: textField widthToView: nil heightToView: lastSecondtextField ];
374
374
375
375
// separateview
376
- UIView *separateView = _textFeildSeparateViews[_textFeilds .count - 2 ];
377
- [_textFeildContentView addConstarintWithView: separateView topView: nil leftView: _textFeildContentView bottomView: nil rightView: _textFeildContentView edageInset: UIEdgeInsetsZero];
378
- [_textFeildContentView addConstarintWithTopView: separateView toBottomView: textFeild constarint: 0 ];
379
- [separateView addConstarintWidth: 0 height: _textFeildorderWidth ];
376
+ UIView *separateView = _textFieldSeparateViews[_textFields .count - 2 ];
377
+ [_textFieldContentView addConstarintWithView: separateView topView: nil leftView: _textFieldContentView bottomView: nil rightView: _textFieldContentView edageInset: UIEdgeInsetsZero];
378
+ [_textFieldContentView addConstarintWithTopView: separateView toBottomView: textField constarint: 0 ];
379
+ [separateView addConstarintWidth: 0 height: _textFieldorderWidth ];
380
380
}
381
381
}
382
382
0 commit comments