Skip to content

Commit 0ea4fd4

Browse files
committed
Merge branch 'v2.0.0'
Conflicts: .gitignore ECSlidingViewController.podspec ECSlidingViewController.xcodeproj/project.pbxproj ECSlidingViewController/AppDelegate.m ECSlidingViewController/InitialSlidingViewController.m ECSlidingViewController/Vendor/ECSlidingViewController/ECSlidingViewController.h ECSlidingViewController/Vendor/ECSlidingViewController/ECSlidingViewController.m README.md Keep all changes/deletions form --theirs. The v2.0.0 branch was re-written from scratch and re-organized.
2 parents d0bc16d + fba9b27 commit 0ea4fd4

File tree

148 files changed

+10026
-2795
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+10026
-2795
lines changed

.gitignore

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
#Mac OS X Finder and whatnot
1+
# Xcode
22
.DS_Store
3-
.idea
4-
5-
# Sparkle distribution Private Key (Don't check me in!)
6-
dsa_priv.pem
7-
8-
# XCode (and ancestors) per-user config (very noisy, and not relevant)
9-
*.mode1
3+
build/
4+
*.pbxuser
5+
!default.pbxuser
106
*.mode1v3
7+
!default.mode1v3
118
*.mode2v3
12-
*.perspective
9+
!default.mode2v3
1310
*.perspectivev3
14-
*.pbxuser
15-
*.xcodeproj/project.xcworkspace/
16-
*.xcodeproj/xcuserdata/
17-
*xcuserdata
18-
xcshareddata
19-
20-
# CocoaPods
21-
Pods
11+
!default.perspectivev3
12+
*.xcworkspace
13+
!default.xcworkspace
14+
xcuserdata
15+
profile
16+
*.moved-aside
17+
DerivedData
18+
.idea/

ECSlidingViewController.podspec

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
Pod::Spec.new do |s|
2-
s.name = 'ECSlidingViewController'
3-
s.version = '1.3.3'
4-
s.license = { :type => 'MIT', :text => <<-LICENSE
5-
Copyright (C) 2013 EdgeCase
2+
s.name = "ECSlidingViewController"
3+
s.version = "2.0.beta.1"
4+
s.summary = "View controller container that presents its child view controllers in two sliding layers. Inspired by the Path 2.0 and Facebook iPhone apps."
5+
s.description = "ECSlidingViewController is a view controller container that presents its child view controllers in two layers. It provides functionality for sliding the top view to reveal the views underneath it. This functionality is inspired by the Path 2.0 and Facebook iPhone apps."
6+
s.homepage = "https://github.com/ECSlidingViewController/ECSlidingViewController"
7+
s.license = 'MIT'
8+
s.author = { "Mike Enriquez" => "[email protected]" }
9+
s.source = { :git => "https://github.com/ECSlidingViewController/ECSlidingViewController.git", :tag => s.version.to_s }
610

7-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11+
s.platform = :ios, '7.0'
12+
s.requires_arc = true
813

9-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10-
11-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12-
LICENSE
13-
}
14-
s.summary = 'View controller container that presents its child view controllers in two sliding layers. Inspired by the Path 2.0 and Facebook iPhone apps.'
15-
s.description = 'ECSlidingViewController is a view controller container that presents its child view controllers in two layers. It provides functionality for sliding the top view to reveal the views underneath it. This functionality is inspired by the Path 2.0 and Facebook iPhone apps.'
16-
s.homepage = 'https://github.com/edgecase/ecslidingviewcontroller'
17-
s.author = { 'Mike Enriquez' => '[email protected]' }
18-
s.source = { :git => 'https://github.com/edgecase/ECSlidingViewController.git', :tag => '1.3.3' }
19-
s.platform = :ios
20-
s.source_files = 'ECSlidingViewController/Vendor/ECSlidingViewController/'
21-
s.requires_arc = true
14+
s.source_files = 'ECSlidingViewController'
2215
end

ECSlidingViewController.xcodeproj/project.pbxproj

Lines changed: 0 additions & 429 deletions
This file was deleted.

ECSlidingViewController/AppDelegate.h

Lines changed: 0 additions & 16 deletions
This file was deleted.

ECSlidingViewController/AppDelegate.m

Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// ECPercentDrivenInteractiveTransition.h
2+
// ECSlidingViewController 2
3+
//
4+
// Copyright (c) 2013, Michael Enriquez (http://enriquez.me)
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in
14+
// all copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
// THE SOFTWARE.
23+
24+
#import <Foundation/Foundation.h>
25+
#import <UIKit/UIKit.h>
26+
27+
/**
28+
Used to create a percent-driven interactive transition. Analogous to `UIPercentDrivenInteractiveTransition` except that it is compatible with `ECSlidingViewController`.
29+
30+
See `ECSlidingInteractiveTransition` as an example subclass that uses a panning gesture to drive the percentage.
31+
32+
You can subclass `ECPercentDrivenInteractiveTransition`, but if you do so you must start each of your method overrides with a call to the super implementation of the method.
33+
*/
34+
@interface ECPercentDrivenInteractiveTransition : NSObject <UIViewControllerInteractiveTransitioning>
35+
36+
/**
37+
The animator object that will be percent-driven. The animation will be triggered when the interactive transition is triggered, but instead of playing from start to finish it will be controlled by the calls to `updateInteractiveTransition:`, `cancelInteractiveTransition`, and `finishInteractiveTransition`.
38+
*/
39+
@property (nonatomic, strong) id<UIViewControllerAnimatedTransitioning> animationController;
40+
41+
/**
42+
The amount of the transition (specified as a percentage of the overall duration) that is complete.
43+
44+
The value in this property reflects the last value passed to the `updateInteractiveTransition:` method.
45+
*/
46+
@property (nonatomic, assign, readonly) CGFloat percentComplete;
47+
48+
/**
49+
Updates the completion percentage of the transition. In general terms, this method is used to "scrub the playhead" of the animation defined by the `animationController`.
50+
51+
While tracking user events, your code should call this method regularly to update the current progress toward completing the transition. If, during tracking, the interactions cross a threshold that you consider signifies the completion or cancellation of the transition, stop tracking events and call the finishInteractiveTransition or cancelInteractiveTransition method.
52+
*/
53+
- (void)updateInteractiveTransition:(CGFloat)percentComplete;
54+
55+
/**
56+
Causes the animation defined by the `animationController` to play from current `percentComplete` to zero percent. You must call this method or `finishInteractiveTransition` at some point during the interaction to ensure everything ends in a consistent state.
57+
*/
58+
- (void)cancelInteractiveTransition;
59+
60+
/**
61+
Causes the animation defined by the `animationController` to play from current `percentComplete` to 100 percent. You must call this method or `cancelInteractiveTransition` at some point during the interaction to ensure everything ends in a consistent state.
62+
*/
63+
- (void)finishInteractiveTransition;
64+
@end
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
// ECPercentDrivenInteractiveTransition.m
2+
// ECSlidingViewController 2
3+
//
4+
// Copyright (c) 2013, Michael Enriquez (http://enriquez.me)
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in
14+
// all copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
// THE SOFTWARE.
23+
24+
#import "ECPercentDrivenInteractiveTransition.h"
25+
26+
@interface ECPercentDrivenInteractiveTransition ()
27+
@property (nonatomic, assign) id<UIViewControllerContextTransitioning> transitionContext;
28+
@end
29+
30+
@implementation ECPercentDrivenInteractiveTransition
31+
32+
- (void)startInteractiveTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
33+
self.transitionContext = transitionContext;
34+
35+
[self.animationController animateTransition:transitionContext];
36+
[self updateInteractiveTransition:0];
37+
}
38+
39+
- (void)updateInteractiveTransition:(CGFloat)percentComplete {
40+
[self.transitionContext updateInteractiveTransition:_percentComplete];
41+
42+
CGFloat boundedPercentage;
43+
if (percentComplete > 1.0) {
44+
boundedPercentage = 1.0;
45+
} else if (percentComplete < 0.0) {
46+
boundedPercentage = 0.0;
47+
} else {
48+
boundedPercentage = percentComplete;
49+
}
50+
51+
_percentComplete = boundedPercentage;
52+
CALayer *layer = [self.transitionContext containerView].layer;
53+
CFTimeInterval pausedTime = [self.animationController transitionDuration:self.transitionContext] * _percentComplete;
54+
layer.speed = 0.0;
55+
layer.timeOffset = pausedTime;
56+
}
57+
58+
- (void)cancelInteractiveTransition {
59+
[self.transitionContext cancelInteractiveTransition];
60+
61+
CADisplayLink *displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(reversePausedAnimation:)];
62+
[displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
63+
}
64+
65+
- (void)finishInteractiveTransition {
66+
[self.transitionContext finishInteractiveTransition];
67+
68+
CALayer *layer = [self.transitionContext containerView].layer;
69+
CFTimeInterval pausedTime = [layer timeOffset];
70+
layer.speed = 1.0;
71+
layer.timeOffset = 0.0;
72+
layer.beginTime = 0.0;
73+
CFTimeInterval timeSincePause = [layer convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime;
74+
layer.beginTime = timeSincePause;
75+
}
76+
77+
#pragma mark - CADisplayLink action
78+
79+
- (void)reversePausedAnimation:(CADisplayLink *)displayLink {
80+
double percentInterval = displayLink.duration / [self.animationController transitionDuration:self.transitionContext];
81+
82+
_percentComplete -= percentInterval;
83+
84+
if (_percentComplete <= 0.0) {
85+
_percentComplete = 0.0;
86+
[displayLink invalidate];
87+
}
88+
89+
[self updateInteractiveTransition:self.percentComplete];
90+
91+
if (_percentComplete == 0.0) {
92+
CALayer *layer = [self.transitionContext containerView].layer;
93+
[layer removeAllAnimations];
94+
layer.speed = 1.0;
95+
}
96+
}
97+
98+
@end
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// ECSlidingAnimationController.h
2+
// ECSlidingViewController 2
3+
//
4+
// Copyright (c) 2013, Michael Enriquez (http://enriquez.me)
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in
14+
// all copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
// THE SOFTWARE.
23+
24+
#import <Foundation/Foundation.h>
25+
#import <UIKit/UIKit.h>
26+
27+
/**
28+
`ECSlidingAnimationController` is the default animator object used by `ECSlidingViewController`. It animates the top view by sliding it horizontally.
29+
30+
An instance this class may be returned from a sliding view controller's delegate for `slidingViewController:animationControllerForOperation:topViewController:`. Do this if you want to use the default animation along with a custom interactive transition.
31+
*/
32+
@interface ECSlidingAnimationController : NSObject <UIViewControllerAnimatedTransitioning>
33+
34+
@end

0 commit comments

Comments
 (0)