@@ -397,6 +397,27 @@ - (void)setLeftLedge:(CGFloat)leftLedge {
397
397
_leftLedge = leftLedge;
398
398
}
399
399
400
+ - (void )setLeftLedge : (CGFloat )leftLedge completion : (void (^)(BOOL finished))completion {
401
+ // Compute the final ledge in two steps. This prevents a strange bug where
402
+ // nesting MAX(X, MIN(Y, Z)) with miniscule referenceBounds returns a bogus near-zero value.
403
+ CGFloat minLedge = MIN (self.referenceBounds .size .width , leftLedge);
404
+ leftLedge = MAX (leftLedge, minLedge);
405
+ if (_viewAppeared && II_FLOAT_EQUAL (self.slidingControllerView .frame .origin .x , self.referenceBounds .size .width - _leftLedge)) {
406
+ if (leftLedge < _leftLedge) {
407
+ [UIView animateWithDuration: CLOSE_SLIDE_DURATION (YES ) animations: ^{
408
+ [self setSlidingFrameForOffset: self .referenceBounds.size.width - leftLedge];
409
+ } completion: completion];
410
+ }
411
+ else if (leftLedge > _leftLedge) {
412
+ [UIView animateWithDuration: OPEN_SLIDE_DURATION (YES ) animations: ^{
413
+ [self setSlidingFrameForOffset: self .referenceBounds.size.width - leftLedge];
414
+ } completion: completion];
415
+ }
416
+ }
417
+ _leftLedge = leftLedge;
418
+ }
419
+
420
+
400
421
- (void )setRightLedge : (CGFloat )rightLedge {
401
422
// Compute the final ledge in two steps. This prevents a strange bug where
402
423
// nesting MAX(X, MIN(Y, Z)) with miniscule referenceBounds returns a bogus near-zero value.
@@ -417,6 +438,27 @@ - (void)setRightLedge:(CGFloat)rightLedge {
417
438
_rightLedge = rightLedge;
418
439
}
419
440
441
+ - (void )setRightLedge : (CGFloat )rightLedge completion : (void (^)(BOOL finished))completion {
442
+ // Compute the final ledge in two steps. This prevents a strange bug where
443
+ // nesting MAX(X, MIN(Y, Z)) with miniscule referenceBounds returns a bogus near-zero value.
444
+ CGFloat minLedge = MIN (self.referenceBounds .size .width , rightLedge);
445
+ rightLedge = MAX (rightLedge, minLedge);
446
+ if (_viewAppeared && II_FLOAT_EQUAL (self.slidingControllerView .frame .origin .x , _rightLedge - self.referenceBounds .size .width )) {
447
+ if (rightLedge < _rightLedge) {
448
+ [UIView animateWithDuration: CLOSE_SLIDE_DURATION (YES ) animations: ^{
449
+ [self setSlidingFrameForOffset: rightLedge - self .referenceBounds.size.width];
450
+ } completion: completion];
451
+ }
452
+ else if (rightLedge > _rightLedge) {
453
+ [UIView animateWithDuration: OPEN_SLIDE_DURATION (YES ) animations: ^{
454
+ [self setSlidingFrameForOffset: rightLedge - self .referenceBounds.size.width];
455
+ } completion: completion];
456
+ }
457
+ }
458
+ _rightLedge = rightLedge;
459
+ }
460
+
461
+
420
462
- (void )setMaxLedge : (CGFloat )maxLedge {
421
463
_maxLedge = maxLedge;
422
464
if (_leftController && _rightController) {
0 commit comments