Skip to content

Commit 0000a92

Browse files
committed
Fixed layering issue with OK button
1 parent 9f6ba6e commit 0000a92

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

TOPasscodeViewController/TOPasscodeViewController.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIVi
260260
{
261261
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
262262

263-
// We don't need to do anything special on iPad
264-
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { return; }
263+
// We don't need to do anything special on iPad or if we're using character input
264+
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad || self.passcodeType == TOPasscodeTypeCustomAlphanumeric) { return; }
265265

266266
// Work out if we need to transition to horizontal
267267
BOOL horizontalLayout = size.height < size.width;
@@ -378,7 +378,7 @@ - (void)layoutAccessoryButtonsForSize:(CGSize)size
378378
// The buttons are always embedded in the keypad view on iPad
379379
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPhone) { return; }
380380

381-
if (self.passcodeView.horizontalLayout) {
381+
if (self.passcodeView.horizontalLayout && self.passcodeType != TOPasscodeTypeCustomAlphanumeric) {
382382
[self horizontalLayoutAccessoryButtonsForSize:size];
383383
}
384384
else {

TOPasscodeViewController/Views/Main/TOPasscodeKeypadView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
1212

1313
@class TOPasscodeCircleButton;
1414

15-
@interface TOPasscodeKeypadView : UIView
15+
@interface TOPasscodeKeypadView : UIView <UIInputViewAudioFeedback>
1616

1717
/** The type of layout for the buttons (Default is vertical) */
1818
@property (nonatomic, assign) BOOL horizontalLayout;

TOPasscodeViewController/Views/Main/TOPasscodeKeypadView.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,12 @@ - (UIImage *)tappedButtonImage
226226
return _keypadButtons;
227227
}
228228

229+
#pragma mark - Audio Delegate Protocol -
230+
- (BOOL)enableInputClicksWhenVisible
231+
{
232+
return YES;
233+
}
234+
229235
#pragma mark - Public Layout Setters -
230236

231237
- (void)setHorizontalLayout:(BOOL)horizontalLayout

TOPasscodeViewController/Views/Main/TOPasscodeView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ - (void)horizontalSizeToFit
295295

296296
- (void)sizeToFit
297297
{
298-
if (self.horizontalLayout) {
298+
if (self.horizontalLayout && self.passcodeType != TOPasscodeTypeCustomAlphanumeric) {
299299
[self horizontalSizeToFit];
300300
}
301301
else {

TOPasscodeViewController/Views/Settings/TOPasscodeSettingsKeypadView.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#import "TOPasscodeSettingsKeypadButton.h"
1111
#import "TOPasscodeButtonLabel.h"
1212
#import "TOSettingsKeypadImage.h"
13-
1413
const CGFloat kTOPasscodeSettingsKeypadButtonInnerSpacing = 7.0f;
1514
const CGFloat kTOPasscodeSettingsKeypadButtonOuterSpacing = 7.0f;
1615
const CGFloat kTOPasscodeSettingsKeypadCornderRadius = 10.0f;
@@ -237,14 +236,15 @@ - (void)buttonTapped:(id)sender
237236
if (self.deleteButtonTappedHandler) {
238237
self.deleteButtonTappedHandler();
239238
}
240-
241239
return;
242240
}
243241

244242
// Handler for the keypad buttons
245243
UIButton *button = (UIButton *)sender;
246244
NSInteger number = button.tag;
247245

246+
[[UIDevice currentDevice] playInputClick];
247+
248248
if (self.numberButtonTappedHandler) {
249249
self.numberButtonTappedHandler(number);
250250
}

TOPasscodeViewController/Views/Shared/TOPasscodeInputField.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ - (void)layoutSubviews
101101
if (!self.submitButton) { return; }
102102

103103
[self.submitButton sizeToFit];
104+
[self bringSubviewToFront:self.submitButton];
105+
104106
CGRect frame = self.submitButton.frame;
105107
if (!self.horizontalLayout) {
106108
frame.origin.x = CGRectGetMaxX(self.bounds) + self.submitButtonSpacing;
@@ -200,6 +202,7 @@ - (void)setPasscode:(NSString *)passcode animated:(BOOL)animated
200202

201203
if (self.submitButton) {
202204
self.submitButton.hidden = (_passcode.length == 0);
205+
[self bringSubviewToFront:self.submitButton];
203206
}
204207

205208
if (passcodeIsComplete && self.passcodeCompletedHandler) {

0 commit comments

Comments
 (0)