@@ -22,6 +22,7 @@ @interface TOPasscodeInputField ()
22
22
@property (nonatomic , strong , readwrite ) TOPasscodeFixedInputView *fixedInputView;
23
23
@property (nonatomic , strong , readwrite ) TOPasscodeVariableInputView *variableInputView;
24
24
@property (nonatomic , strong , readwrite ) UIButton *submitButton;
25
+ @property (nonatomic , strong , readwrite ) UIVisualEffectView *visualEffectView;
25
26
26
27
@end
27
28
@@ -55,6 +56,9 @@ - (void)setUp
55
56
self.backgroundColor = [UIColor clearColor ];
56
57
_submitButtonSpacing = 4 .0f ;
57
58
_submitButtonVerticalSpacing = 5 .0f ;
59
+
60
+ _visualEffectView = [[UIVisualEffectView alloc ] initWithEffect: nil ];
61
+ [self addSubview: _visualEffectView];
58
62
}
59
63
60
64
- (void )setUpForStyle : (TOPasscodeInputFieldStyle)style
@@ -67,11 +71,11 @@ - (void)setUpForStyle:(TOPasscodeInputFieldStyle)style
67
71
68
72
if (style == TOPasscodeInputFieldStyleVariable) {
69
73
self.variableInputView = [[TOPasscodeVariableInputView alloc ] init ];
70
- [self .contentView addSubview: self .variableInputView];
74
+ [self .visualEffectView. contentView addSubview: self .variableInputView];
71
75
}
72
76
else {
73
77
self.fixedInputView = [[TOPasscodeFixedInputView alloc ] init ];
74
- [self .contentView addSubview: self .fixedInputView];
78
+ [self .visualEffectView. contentView addSubview: self .fixedInputView];
75
79
}
76
80
77
81
// Set the frame for the currently visible input view
@@ -98,6 +102,8 @@ - (void)layoutSubviews
98
102
{
99
103
[super layoutSubviews ];
100
104
105
+ self.visualEffectView .frame = self.inputField .bounds ;
106
+
101
107
if (!self.submitButton ) { return ; }
102
108
103
109
[self .submitButton sizeToFit ];
@@ -368,15 +374,15 @@ - (void)setHorizontalLayout:(BOOL)horizontalLayout animated:(BOOL)animated durat
368
374
369
375
UIView *snapshotView = nil ;
370
376
371
- if (self.submitButton .hidden == NO && animated) {
377
+ if (self.submitButton && self. submitButton .hidden == NO && animated) {
372
378
snapshotView = [self .submitButton snapshotViewAfterScreenUpdates: NO ];
373
379
snapshotView.frame = self.submitButton .frame ;
374
380
[self addSubview: snapshotView];
375
381
}
376
382
377
383
_horizontalLayout = horizontalLayout;
378
384
379
- if (!animated) {
385
+ if (!animated || !self. submitButton ) {
380
386
[self sizeToFit ];
381
387
[self setNeedsLayout ];
382
388
return ;
0 commit comments