Permalink
Browse files

fixed left and right peaking, added protocol to notify left/right on …

…reveal
  • Loading branch information...
1 parent bb75fc2 commit 152dd60865216acdef550313c9765feb45a1ef9e @rnystrom committed Feb 23, 2013
View
@@ -118,6 +118,18 @@ NSString * const RNSwipeViewControllerCenterDidAppear;
The only real KVO-purposed property in here is <code>isToggled</code>. If there is a need for more options I'll add them.
+## Percent Protocol ##
+
+#### New Feature
+
+Your left, right, and bottom view controllers can optionally conform to the <code>RNRevealViewControllerProtocol</code> protocol in order to receive updates on how far the view controller is presented. The percent is an integer 0 to 100. The only method this protocol uses is:
+
+``` objective-c
+- (void)changedPercentReveal:(NSInteger)percent;
+```
+
+The example updates views in the left and right controller.
+
## Status ##
If you're interested in what your swipe controller looks like presently, you can ask the <code>visibleState</code> property what is showing. The possibilities are
View
@@ -0,0 +1,15 @@
+//
+// RNRightViewController.h
+// RNSwipeViewController
+//
+// Created by Ryan Nystrom on 2/22/13.
+// Copyright (c) 2013 Ryan Nystrom. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "RNRevealViewControllerProtocol.h"
+
+@interface RNRightViewController : UIViewController
+<RNRevealViewControllerProtocol>
+
+@end
View
@@ -0,0 +1,56 @@
+//
+// RNRightViewController.m
+// RNSwipeViewController
+//
+// Created by Ryan Nystrom on 2/22/13.
+// Copyright (c) 2013 Ryan Nystrom. All rights reserved.
+//
+
+#import "RNRightViewController.h"
+#import "UIView+Sizes.h"
+
+@interface RNRightViewController ()
+@property (weak, nonatomic) IBOutlet UIView *animateView;
+
+@end
+
+@implementation RNRightViewController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ // Custom initialization
+ }
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+}
+
+- (void)didReceiveMemoryWarning
+{
+ [super didReceiveMemoryWarning];
+ // Dispose of any resources that can be recreated.
+}
+
+- (void)changedPercentReveal:(NSInteger)percent {
+ NSLog(@"Right: %i",percent);
+
+ if (percent == 100) {
+ [UIView animateWithDuration:0.1f
+ delay:0
+ options:0
+ animations:^{
+ self.animateView.top = percent - 100;
+ }
+ completion:NULL];
+ }
+ else {
+ self.animateView.top = percent - 100;
+ }
+}
+
+@end
@@ -29,6 +29,8 @@
86D329A0164C7DAC005CE5EA /* iPad_MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 86D3299E164C7DAC005CE5EA /* iPad_MainStoryboard.storyboard */; };
86DF0089164464FC00ECA1B8 /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 86DF0087164464FC00ECA1B8 /* MainStoryboard.storyboard */; };
86DF008C1644662900ECA1B8 /* RNToolsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 86DF008B1644662900ECA1B8 /* RNToolsViewController.m */; };
+ 86E0C77116D839CA00BC352C /* RNBottomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 86E0C77016D839CA00BC352C /* RNBottomViewController.m */; };
+ 86E0C77416D839D000BC352C /* RNRightViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 86E0C77316D839D000BC352C /* RNRightViewController.m */; };
86EA76511644402F0019E5E4 /* RNDirectionPanGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 86EA764B1644402F0019E5E4 /* RNDirectionPanGestureRecognizer.m */; };
86EA76521644402F0019E5E4 /* RNSwipeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 86EA764D1644402F0019E5E4 /* RNSwipeViewController.m */; };
86EA76531644402F0019E5E4 /* UIView+Sizes.m in Sources */ = {isa = PBXBuildFile; fileRef = 86EA76501644402F0019E5E4 /* UIView+Sizes.m */; };
@@ -67,6 +69,11 @@
86DF0088164464FC00ECA1B8 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = example/en.lproj/MainStoryboard.storyboard; sourceTree = "<group>"; };
86DF008A1644662900ECA1B8 /* RNToolsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNToolsViewController.h; path = example/RNToolsViewController.h; sourceTree = "<group>"; };
86DF008B1644662900ECA1B8 /* RNToolsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RNToolsViewController.m; path = example/RNToolsViewController.m; sourceTree = "<group>"; };
+ 86E0C76E16D8370900BC352C /* RNRevealViewControllerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNRevealViewControllerProtocol.h; sourceTree = "<group>"; };
+ 86E0C76F16D839CA00BC352C /* RNBottomViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNBottomViewController.h; path = example/RNBottomViewController.h; sourceTree = "<group>"; };
+ 86E0C77016D839CA00BC352C /* RNBottomViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RNBottomViewController.m; path = example/RNBottomViewController.m; sourceTree = "<group>"; };
+ 86E0C77216D839D000BC352C /* RNRightViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNRightViewController.h; sourceTree = "<group>"; };
+ 86E0C77316D839D000BC352C /* RNRightViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNRightViewController.m; sourceTree = "<group>"; };
86EA764A1644402F0019E5E4 /* RNDirectionPanGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNDirectionPanGestureRecognizer.h; sourceTree = "<group>"; };
86EA764B1644402F0019E5E4 /* RNDirectionPanGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNDirectionPanGestureRecognizer.m; sourceTree = "<group>"; };
86EA764C1644402F0019E5E4 /* RNSwipeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSwipeViewController.h; sourceTree = "<group>"; };
@@ -105,21 +112,25 @@
86A9F8B61641AD3D00809316 = {
isa = PBXGroup;
children = (
- 86C764BD16447849000A0F31 /* System */,
- 86526387164469AA00379EA3 /* RNLeftViewController.h */,
- 86526388164469AA00379EA3 /* RNLeftViewController.m */,
- 86DF0087164464FC00ECA1B8 /* MainStoryboard.storyboard */,
+ 86A9F8C41641AD3D00809316 /* Frameworks */,
86D3299E164C7DAC005CE5EA /* iPad_MainStoryboard.storyboard */,
- 86DF008A1644662900ECA1B8 /* RNToolsViewController.h */,
- 86DF008B1644662900ECA1B8 /* RNToolsViewController.m */,
+ 86DF0087164464FC00ECA1B8 /* MainStoryboard.storyboard */,
+ 86A9F8C21641AD3D00809316 /* Products */,
86EA7659164440A80019E5E4 /* RNAppDelegate.h */,
86EA765A164440A80019E5E4 /* RNAppDelegate.m */,
+ 86E0C76F16D839CA00BC352C /* RNBottomViewController.h */,
+ 86E0C77016D839CA00BC352C /* RNBottomViewController.m */,
86EA765D164440A80019E5E4 /* RNExampleViewController.h */,
86EA765E164440A80019E5E4 /* RNExampleViewController.m */,
+ 86526387164469AA00379EA3 /* RNLeftViewController.h */,
+ 86526388164469AA00379EA3 /* RNLeftViewController.m */,
+ 86E0C77216D839D000BC352C /* RNRightViewController.h */,
+ 86E0C77316D839D000BC352C /* RNRightViewController.m */,
86EA76491644402F0019E5E4 /* RNSwipeViewController */,
+ 86DF008A1644662900ECA1B8 /* RNToolsViewController.h */,
+ 86DF008B1644662900ECA1B8 /* RNToolsViewController.m */,
86A9F8CC1641AD3D00809316 /* Supporting Files */,
- 86A9F8C41641AD3D00809316 /* Frameworks */,
- 86A9F8C21641AD3D00809316 /* Products */,
+ 86C764BD16447849000A0F31 /* System */,
);
sourceTree = "<group>";
};
@@ -182,6 +193,7 @@
86EA764B1644402F0019E5E4 /* RNDirectionPanGestureRecognizer.m */,
86EA764C1644402F0019E5E4 /* RNSwipeViewController.h */,
86EA764D1644402F0019E5E4 /* RNSwipeViewController.m */,
+ 86E0C76E16D8370900BC352C /* RNRevealViewControllerProtocol.h */,
86EA764E1644402F0019E5E4 /* RNSwipeViewControllerDelegate.h */,
86EA764F1644402F0019E5E4 /* UIView+Sizes.h */,
86EA76501644402F0019E5E4 /* UIView+Sizes.m */,
@@ -292,6 +304,8 @@
86526385164466E000379EA3 /* UIViewController+RNSwipeViewController.m in Sources */,
86526389164469AA00379EA3 /* RNLeftViewController.m in Sources */,
86F09D03164961BE00985A7E /* UIApplication+AppDimensions.m in Sources */,
+ 86E0C77116D839CA00BC352C /* RNBottomViewController.m in Sources */,
+ 86E0C77416D839D000BC352C /* RNRightViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -0,0 +1,15 @@
+//
+// RNRevealViewControllerProtocol.h
+// RNSwipeViewController
+//
+// Created by Ryan Nystrom on 2/22/13.
+// Copyright (c) 2013 Ryan Nystrom. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@protocol RNRevealViewControllerProtocol <NSObject>
+
+- (void)changedPercentReveal:(NSInteger)percent;
+
+@end
Oops, something went wrong.

0 comments on commit 152dd60

Please sign in to comment.