This repository was archived by the owner on Jan 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +29
-3
lines changed Expand file tree Collapse file tree 1 file changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,32 @@ static BOOL PFOAuth1FlowDialogIsDevicePad() {
5555 return isPad;
5656}
5757
58+ static CGFloat PFTFloatRound (CGFloat value, NSRoundingMode mode) {
59+ switch (mode) {
60+ case NSRoundPlain:
61+ case NSRoundBankers:
62+ #if CGFLOAT_IS_DOUBLE
63+ value = round (value);
64+ #else
65+ value = roundf (value);
66+ #endif
67+ case NSRoundDown:
68+ #if CGFLOAT_IS_DOUBLE
69+ value = floor (value);
70+ #else
71+ value = floorf (value);
72+ #endif
73+ case NSRoundUp:
74+ #if CGFLOAT_IS_DOUBLE
75+ value = ceil (value);
76+ #else
77+ value = ceilf (value);
78+ #endif
79+ default : break ;
80+ }
81+ return value;
82+ }
83+
5884#pragma mark -
5985#pragma mark Class
6086
@@ -461,7 +487,7 @@ - (void)_removeObservers {
461487- (void )_deviceOrientationDidChange : (NSNotification *)notification {
462488 UIInterfaceOrientation orientation = [UIApplication sharedApplication ].statusBarOrientation ;
463489 if ([self _shouldRotateToOrientation: orientation]) {
464- CGFloat duration = [UIApplication sharedApplication ].statusBarOrientationAnimationDuration ;
490+ NSTimeInterval duration = [UIApplication sharedApplication ].statusBarOrientationAnimationDuration ;
465491 [UIView animateWithDuration: duration
466492 animations: ^{
467493 [self _sizeToFitOrientation ];
@@ -518,8 +544,8 @@ - (void)_sizeToFitOrientation {
518544
519545 CGFloat scale = (PFOAuth1FlowDialogIsDevicePad () ? 0 .6f : 1 .0f );
520546
521- CGFloat width = floor ( scale * CGRectGetWidth (transformedBounds)) - PFOAuth1FlowDialogScreenInset * 2 .0f ;
522- CGFloat height = floor ( scale * CGRectGetHeight (transformedBounds)) - PFOAuth1FlowDialogScreenInset * 2 .0f ;
547+ CGFloat width = PFTFloatRound (( scale * CGRectGetWidth (transformedBounds)) - PFOAuth1FlowDialogScreenInset * 2 .0f , NSRoundDown) ;
548+ CGFloat height = PFTFloatRound (( scale * CGRectGetHeight (transformedBounds)) - PFOAuth1FlowDialogScreenInset * 2 .0f , NSRoundDown) ;
523549
524550 self.transform = transform;
525551 self.center = center;
You can’t perform that action at this time.
0 commit comments