@@ -175,7 +175,7 @@ - (void)setUpAccessoryButtons
175175 }
176176 }
177177
178- [self updateAccessoryButtonFontsForWidth :self .view.bounds.size.width ];
178+ [self updateAccessoryButtonFontsForSize :self .view.bounds.size];
179179}
180180
181181#pragma mark - View Management -
@@ -202,21 +202,15 @@ - (void)viewDidAppear:(BOOL)animated
202202- (void )viewDidLayoutSubviews
203203{
204204 CGSize bounds = self.view .bounds .size ;
205- CGFloat width = bounds.width ;
206-
207- // If on an iPhone (and we're potentially rotated), work out the minimum width we can be
208- if (UI_USER_INTERFACE_IDIOM () == UIUserInterfaceIdiomPhone) {
209- width = MIN (bounds.width , bounds.height );
210- }
211205
212206 // Update the accessory button sizes
213- [self updateAccessoryButtonFontsForWidth: width ];
207+ [self updateAccessoryButtonFontsForSize: bounds ];
214208
215209 // Re-layout the accessory buttons
216- [self layoutAccessoryButtonsForWidth: width ];
210+ [self layoutAccessoryButtonsForSize: bounds ];
217211
218212 // Resize the pin view to scale to the new size
219- [self .passcodeView sizeToFitWidth: width ];
213+ [self .passcodeView sizeToFitSize: bounds ];
220214
221215 // Re-center the pin view
222216 CGRect frame = self.passcodeView .frame ;
@@ -292,8 +286,13 @@ - (void)applyThemeForStyle:(TOPasscodeViewStyle)style
292286 self.backgroundView .backgroundColor = isDark ? [UIColor colorWithWhite: 0 .1f alpha: 1 .0f ] : [UIColor whiteColor ];
293287}
294288
295- - (void )updateAccessoryButtonFontsForWidth : (CGFloat) width
289+ - (void )updateAccessoryButtonFontsForSize : (CGSize) size
296290{
291+ CGFloat width = size.width ;
292+ if (UI_USER_INTERFACE_IDIOM () == UIUserInterfaceIdiomPhone) {
293+ width = MIN (size.width , size.height );
294+ }
295+
297296 CGFloat pointSize = 17 .0f ;
298297 if (width < TOPasscodeViewContentSizeMedium) {
299298 pointSize = 14 .0f ;
@@ -310,10 +309,12 @@ - (void)updateAccessoryButtonFontsForWidth:(CGFloat)width
310309 self.rightAccessoryButton .titleLabel .font = accessoryFont;
311310}
312311
313- - (void )layoutAccessoryButtonsForWidth : (CGFloat) width
312+ - (void )layoutAccessoryButtonsForSize : (CGSize) size
314313{
315314 if (UI_USER_INTERFACE_IDIOM () != UIUserInterfaceIdiomPhone) { return ; }
316315
316+ CGFloat width = MIN (size.width , size.height );
317+
317318 CGFloat verticalInset = 54 .0f ;
318319 if (width < TOPasscodeViewContentSizeMedium) {
319320 verticalInset = 37 .0f ;
0 commit comments