@@ -22,6 +22,7 @@ @interface TOPasscodeInputField ()
2222@property (nonatomic , strong , readwrite ) TOPasscodeFixedInputView *fixedInputView;
2323@property (nonatomic , strong , readwrite ) TOPasscodeVariableInputView *variableInputView;
2424@property (nonatomic , strong , readwrite ) UIButton *submitButton;
25+ @property (nonatomic , strong , readwrite ) UIVisualEffectView *visualEffectView;
2526
2627@end
2728
@@ -55,6 +56,9 @@ - (void)setUp
5556 self.backgroundColor = [UIColor clearColor ];
5657 _submitButtonSpacing = 4 .0f ;
5758 _submitButtonVerticalSpacing = 5 .0f ;
59+
60+ _visualEffectView = [[UIVisualEffectView alloc ] initWithEffect: nil ];
61+ [self addSubview: _visualEffectView];
5862}
5963
6064- (void )setUpForStyle : (TOPasscodeInputFieldStyle)style
@@ -67,11 +71,11 @@ - (void)setUpForStyle:(TOPasscodeInputFieldStyle)style
6771
6872 if (style == TOPasscodeInputFieldStyleVariable) {
6973 self.variableInputView = [[TOPasscodeVariableInputView alloc ] init ];
70- [self .contentView addSubview: self .variableInputView];
74+ [self .visualEffectView. contentView addSubview: self .variableInputView];
7175 }
7276 else {
7377 self.fixedInputView = [[TOPasscodeFixedInputView alloc ] init ];
74- [self .contentView addSubview: self .fixedInputView];
78+ [self .visualEffectView. contentView addSubview: self .fixedInputView];
7579 }
7680
7781 // Set the frame for the currently visible input view
@@ -98,6 +102,8 @@ - (void)layoutSubviews
98102{
99103 [super layoutSubviews ];
100104
105+ self.visualEffectView .frame = self.inputField .bounds ;
106+
101107 if (!self.submitButton ) { return ; }
102108
103109 [self .submitButton sizeToFit ];
@@ -368,15 +374,15 @@ - (void)setHorizontalLayout:(BOOL)horizontalLayout animated:(BOOL)animated durat
368374
369375 UIView *snapshotView = nil ;
370376
371- if (self.submitButton .hidden == NO && animated) {
377+ if (self.submitButton && self. submitButton .hidden == NO && animated) {
372378 snapshotView = [self .submitButton snapshotViewAfterScreenUpdates: NO ];
373379 snapshotView.frame = self.submitButton .frame ;
374380 [self addSubview: snapshotView];
375381 }
376382
377383 _horizontalLayout = horizontalLayout;
378384
379- if (!animated) {
385+ if (!animated || !self. submitButton ) {
380386 [self sizeToFit ];
381387 [self setNeedsLayout ];
382388 return ;
0 commit comments