Skip to content

Commit 4b8073b

Browse files
iwasrobbedenriquez
authored andcommitted
Allow default transition duration to be set
1 parent b30b1c5 commit 4b8073b

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

ECSlidingViewController/ECSlidingAnimationController.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,9 @@
3131
*/
3232
@interface ECSlidingAnimationController : NSObject <UIViewControllerAnimatedTransitioning>
3333

34+
/**
35+
The default duration of the view transition.
36+
*/
37+
@property (nonatomic, assign) NSTimeInterval defaultTransitionDuration;
38+
3439
@end

ECSlidingViewController/ECSlidingAnimationController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ @implementation ECSlidingAnimationController
3434
#pragma mark - UIViewControllerAnimatedTransitioning
3535

3636
- (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)transitionContext {
37-
return 0.25;
37+
return _defaultTransitionDuration ?: 0.25;
3838
}
3939

4040
- (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext {

ECSlidingViewController/ECSlidingViewController.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,4 +298,9 @@
298298
*/
299299
@property (nonatomic, strong) NSArray *customAnchoredGestures;
300300

301+
/**
302+
The default duration of the view transition.
303+
*/
304+
@property (nonatomic, assign) NSTimeInterval defaultTransitionDuration;
305+
301306
@end

ECSlidingViewController/ECSlidingViewController.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ - (void)setAnchorRightRevealAmount:(CGFloat)anchorRightRevealAmount {
321321
self.preserveRightPeekAmount = NO;
322322
}
323323

324+
- (void)setDefaultTransitionDuration:(NSTimeInterval)defaultTransitionDuration {
325+
self.defaultAnimationController.defaultTransitionDuration = defaultTransitionDuration;
326+
}
327+
324328
- (CGFloat)anchorLeftPeekAmount {
325329
if (_anchorLeftPeekAmount == CGFLOAT_MAX && _anchorLeftRevealAmount != CGFLOAT_MAX) {
326330
return CGRectGetWidth(self.view.bounds) - _anchorLeftRevealAmount;

0 commit comments

Comments
 (0)