@@ -175,7 +175,7 @@ - (void)setUpAccessoryButtons
175
175
}
176
176
}
177
177
178
- [self updateAccessoryButtonFontsForWidth :self .view.bounds.size.width ];
178
+ [self updateAccessoryButtonFontsForSize :self .view.bounds.size];
179
179
}
180
180
181
181
#pragma mark - View Management -
@@ -202,21 +202,15 @@ - (void)viewDidAppear:(BOOL)animated
202
202
- (void )viewDidLayoutSubviews
203
203
{
204
204
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
- }
211
205
212
206
// Update the accessory button sizes
213
- [self updateAccessoryButtonFontsForWidth: width ];
207
+ [self updateAccessoryButtonFontsForSize: bounds ];
214
208
215
209
// Re-layout the accessory buttons
216
- [self layoutAccessoryButtonsForWidth: width ];
210
+ [self layoutAccessoryButtonsForSize: bounds ];
217
211
218
212
// Resize the pin view to scale to the new size
219
- [self .passcodeView sizeToFitWidth: width ];
213
+ [self .passcodeView sizeToFitSize: bounds ];
220
214
221
215
// Re-center the pin view
222
216
CGRect frame = self.passcodeView .frame ;
@@ -292,8 +286,13 @@ - (void)applyThemeForStyle:(TOPasscodeViewStyle)style
292
286
self.backgroundView .backgroundColor = isDark ? [UIColor colorWithWhite: 0 .1f alpha: 1 .0f ] : [UIColor whiteColor ];
293
287
}
294
288
295
- - (void )updateAccessoryButtonFontsForWidth : (CGFloat) width
289
+ - (void )updateAccessoryButtonFontsForSize : (CGSize) size
296
290
{
291
+ CGFloat width = size.width ;
292
+ if (UI_USER_INTERFACE_IDIOM () == UIUserInterfaceIdiomPhone) {
293
+ width = MIN (size.width , size.height );
294
+ }
295
+
297
296
CGFloat pointSize = 17 .0f ;
298
297
if (width < TOPasscodeViewContentSizeMedium) {
299
298
pointSize = 14 .0f ;
@@ -310,10 +309,12 @@ - (void)updateAccessoryButtonFontsForWidth:(CGFloat)width
310
309
self.rightAccessoryButton .titleLabel .font = accessoryFont;
311
310
}
312
311
313
- - (void )layoutAccessoryButtonsForWidth : (CGFloat) width
312
+ - (void )layoutAccessoryButtonsForSize : (CGSize) size
314
313
{
315
314
if (UI_USER_INTERFACE_IDIOM () != UIUserInterfaceIdiomPhone) { return ; }
316
315
316
+ CGFloat width = MIN (size.width , size.height );
317
+
317
318
CGFloat verticalInset = 54 .0f ;
318
319
if (width < TOPasscodeViewContentSizeMedium) {
319
320
verticalInset = 37 .0f ;
0 commit comments