Skip to content

Commit

Permalink
Minimum viable interactive view controller transition.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashfurrow committed Jul 22, 2013
1 parent 63916f4 commit 698c35f
Show file tree
Hide file tree
Showing 13 changed files with 372 additions and 21 deletions.
1 change: 1 addition & 0 deletions Reveal.framework/Headers
1 change: 1 addition & 0 deletions Reveal.framework/Reveal
17 changes: 17 additions & 0 deletions Reveal.framework/Versions/A/Headers/IBARevealLoader.h
@@ -0,0 +1,17 @@
//
// Copyright (c) 2013 Itty Bitty Apps. All rights reserved.

#import <Foundation/Foundation.h>

extern NSString * const IBARevealLoaderRequestStartNotification;
extern NSString * const IBARevealLoaderRequestStopNotification;

extern NSString * const IBARevealLoaderSetOptionsNotification;
extern NSString * const IBARevealLoaderOptionsLogLevelMaskKey;

@interface IBARevealLoader : NSObject

+ (void)startServer;
+ (void)stopServer;

@end
53 changes: 53 additions & 0 deletions Reveal.framework/Versions/A/Headers/IBARevealLogger.h
@@ -0,0 +1,53 @@
// Copyright (c) 2013 Itty Bitty Apps Pty Ltd. All rights reserved.
//

#import <Foundation/Foundation.h>

/*!
\brief The Reveal Log level bit flags.
\discussion These flags are addative. Ie, you should bitwise OR them together.
\seealso IBARevealLoggerSetLevelMask
\seealso IBARevealLoggerGetLevelMask
Example:
// Enable Error, Warning and Info logger levels.
IBARevealLoggerSetLevelMask(IBARevealLogLevelError|IBARevealLogLevelWarn|IBARevealLogLevelInfo);
*/
typedef NS_OPTIONS(int32_t, IBARevealLogLevel)
{
IBARevealLogLevelNone = 0,
IBARevealLogLevelDebug = (1 << 0),
IBARevealLogLevelInfo = (1 << 1),
IBARevealLogLevelWarn = (1 << 2),
IBARevealLogLevelError = (1 << 3)
};

/*!
\brief Set the Reveal logger level mask.
\param mask A bit mask which is a combination of the IBARevealLogLevel enum options.
\discussion If you do not wish to see log messages from Reveal you should call this function with an appropriate level mask as early in your application's lifecycle as possible. For example in your application's main() function.
Example:
// Enable Error, Warning and Info logger levels.
IBARevealLoggerSetLevelMask(IBARevealLogLevelError|IBARevealLogLevelWarn|IBARevealLogLevelInfo);
*/
extern void IBARevealLoggerSetLevelMask(int32_t mask);

/*!
\brief Get the current Reveal logger level mask.
\return A bit mask representing the levels at which Reveal is currently logging.
\discussion The default Reveal Logger level mask is IBARevealLogLevelError|IBARevealLogLevelWarn|IBARevealLogLevelInfo.
Example:
// Turn off the Info log level.
IBARevealLoggerSetLevelMask(IBARevealLoggerGetLevelMask() & ~IBARevealLogLevelInfo);
*/
extern int32_t IBARevealLoggerGetLevelMask(void);
5 changes: 5 additions & 0 deletions Reveal.framework/Versions/A/Headers/Reveal.h
@@ -0,0 +1,5 @@
// Copyright (c) 2013 Itty Bitty Apps Pty Ltd. All rights reserved.
//

#import "IBARevealLogger.h"
#import "IBARevealLoader.h"
Binary file added Reveal.framework/Versions/A/Reveal
Binary file not shown.
1 change: 1 addition & 0 deletions Reveal.framework/Versions/Current
38 changes: 36 additions & 2 deletions UIViewController-Transitions-Example.xcodeproj/project.pbxproj
Expand Up @@ -7,7 +7,12 @@
objects = {

/* Begin PBXBuildFile section */
5E6543B2179DAD4100ED0C76 /* Reveal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E6543B1179DAD4100ED0C76 /* Reveal.framework */; };
5E6543B4179DAD6400ED0C76 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E6543B3179DAD6400ED0C76 /* CFNetwork.framework */; };
5E6543B6179DAD6900ED0C76 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E6543B5179DAD6900ED0C76 /* QuartzCore.framework */; };
5E6752691798570100601F42 /* TLTransitionAnimator.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E6752681798570100601F42 /* TLTransitionAnimator.m */; };
5E67527317985B6D00601F42 /* TLMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E67527217985B6D00601F42 /* TLMenuViewController.m */; };
5E67527617985FE400601F42 /* TLMenuInteractor.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E67527517985FE400601F42 /* TLMenuInteractor.m */; };
5E8B4B6F1790454A006BFAB2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E8B4B6E1790454A006BFAB2 /* Foundation.framework */; };
5E8B4B711790454A006BFAB2 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E8B4B701790454A006BFAB2 /* CoreGraphics.framework */; };
5E8B4B731790454A006BFAB2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E8B4B721790454A006BFAB2 /* UIKit.framework */; };
Expand Down Expand Up @@ -36,8 +41,15 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
5E6543B1179DAD4100ED0C76 /* Reveal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Reveal.framework; sourceTree = "<group>"; };
5E6543B3179DAD6400ED0C76 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
5E6543B5179DAD6900ED0C76 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
5E6752671798570100601F42 /* TLTransitionAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLTransitionAnimator.h; sourceTree = "<group>"; };
5E6752681798570100601F42 /* TLTransitionAnimator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLTransitionAnimator.m; sourceTree = "<group>"; };
5E67527117985B6D00601F42 /* TLMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLMenuViewController.h; sourceTree = "<group>"; };
5E67527217985B6D00601F42 /* TLMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLMenuViewController.m; sourceTree = "<group>"; };
5E67527417985FE400601F42 /* TLMenuInteractor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLMenuInteractor.h; sourceTree = "<group>"; };
5E67527517985FE400601F42 /* TLMenuInteractor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLMenuInteractor.m; sourceTree = "<group>"; };
5E8B4B6B1790454A006BFAB2 /* UIViewController-Transitions-Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "UIViewController-Transitions-Example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
5E8B4B6E1790454A006BFAB2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
5E8B4B701790454A006BFAB2 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -66,9 +78,12 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
5E6543B6179DAD6900ED0C76 /* QuartzCore.framework in Frameworks */,
5E6543B4179DAD6400ED0C76 /* CFNetwork.framework in Frameworks */,
5E8B4B711790454A006BFAB2 /* CoreGraphics.framework in Frameworks */,
5E8B4B731790454A006BFAB2 /* UIKit.framework in Frameworks */,
5E8B4B6F1790454A006BFAB2 /* Foundation.framework in Frameworks */,
5E6543B2179DAD4100ED0C76 /* Reveal.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -107,6 +122,9 @@
5E8B4B6D1790454A006BFAB2 /* Frameworks */ = {
isa = PBXGroup;
children = (
5E6543B5179DAD6900ED0C76 /* QuartzCore.framework */,
5E6543B3179DAD6400ED0C76 /* CFNetwork.framework */,
5E6543B1179DAD4100ED0C76 /* Reveal.framework */,
5E8B4B6E1790454A006BFAB2 /* Foundation.framework */,
5E8B4B701790454A006BFAB2 /* CoreGraphics.framework */,
5E8B4B721790454A006BFAB2 /* UIKit.framework */,
Expand All @@ -125,10 +143,14 @@
5E8B4B841790454A006BFAB2 /* TLMasterViewController.m */,
5E8B4B861790454A006BFAB2 /* TLDetailViewController.h */,
5E8B4B871790454A006BFAB2 /* TLDetailViewController.m */,
5E8B4B891790454A006BFAB2 /* Images.xcassets */,
5E8B4B751790454A006BFAB2 /* Supporting Files */,
5E67527117985B6D00601F42 /* TLMenuViewController.h */,
5E67527217985B6D00601F42 /* TLMenuViewController.m */,
5E6752671798570100601F42 /* TLTransitionAnimator.h */,
5E6752681798570100601F42 /* TLTransitionAnimator.m */,
5E67527417985FE400601F42 /* TLMenuInteractor.h */,
5E67527517985FE400601F42 /* TLMenuInteractor.m */,
5E8B4B891790454A006BFAB2 /* Images.xcassets */,
5E8B4B751790454A006BFAB2 /* Supporting Files */,
);
path = "UIViewController-Transitions-Example";
sourceTree = "<group>";
Expand Down Expand Up @@ -264,7 +286,9 @@
5E6752691798570100601F42 /* TLTransitionAnimator.m in Sources */,
5E8B4B881790454A006BFAB2 /* TLDetailViewController.m in Sources */,
5E8B4B7F1790454A006BFAB2 /* TLAppDelegate.m in Sources */,
5E67527617985FE400601F42 /* TLMenuInteractor.m in Sources */,
5E8B4B7B1790454A006BFAB2 /* main.m in Sources */,
5E67527317985B6D00601F42 /* TLMenuViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -387,9 +411,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "UIViewController-Transitions-Example/UIViewController-Transitions-Example-Prefix.pch";
INFOPLIST_FILE = "UIViewController-Transitions-Example/UIViewController-Transitions-Example-Info.plist";
OTHER_LDFLAGS = "-ObjC ";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
Expand All @@ -400,9 +429,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "UIViewController-Transitions-Example/UIViewController-Transitions-Example-Prefix.pch";
INFOPLIST_FILE = "UIViewController-Transitions-Example/UIViewController-Transitions-Example-Info.plist";
OTHER_LDFLAGS = "-ObjC ";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
Expand Down
38 changes: 19 additions & 19 deletions UIViewController-Transitions-Example/TLMasterViewController.m
Expand Up @@ -7,16 +7,21 @@
//

#import "TLMasterViewController.h"
#import "TLMenuViewController.h"

#import "TLDetailViewController.h"

#import "TLTransitionAnimator.h"
#import "TLMenuInteractor.h"


@interface TLMasterViewController () <UIViewControllerTransitioningDelegate>
{
NSMutableArray *_objects;
}

@property (nonatomic, strong) TLMenuInteractor *transition;

@end

@implementation TLMasterViewController
Expand All @@ -33,6 +38,12 @@ - (void)viewDidLoad

UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)];
self.navigationItem.rightBarButtonItem = addButton;

self.transition = [[TLMenuInteractor alloc] initWithParentViewController:self];

UIScreenEdgePanGestureRecognizer *gestureRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self.transition action:@selector(userDidPan:)];
gestureRecognizer.edges = UIRectEdgeLeft;
[self.view addGestureRecognizer:gestureRecognizer];
}

-(void)viewDidAppear:(BOOL)animated {
Expand Down Expand Up @@ -85,32 +96,21 @@ -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *

#pragma mark - UIViewControllerTransitioningDelegate Methods

- (id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented
presentingController:(UIViewController *)presenting
sourceController:(UIViewController *)source {

if ([presented isKindOfClass:[TLDetailViewController class]]) {
TLTransitionAnimator *animator = [TLTransitionAnimator new];
//Configure the animator
animator.presenting = YES;
return animator;
}
else {
return nil;
}
TLTransitionAnimator *animator = [TLTransitionAnimator new];
//Configure the animator
animator.presenting = YES;
return animator;
}

- (id <UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
if ([dismissed isKindOfClass:[TLDetailViewController class]]) {
TLTransitionAnimator *animator = [TLTransitionAnimator new];
return animator;
}
else {
return nil;
}
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
TLTransitionAnimator *animator = [TLTransitionAnimator new];
return animator;
}


@end


19 changes: 19 additions & 0 deletions UIViewController-Transitions-Example/TLMenuInteractor.h
@@ -0,0 +1,19 @@
//
// TLMenuInteractor.h
// UIViewController-Transitions-Example
//
// Created by Ash Furrow on 2013-07-18.
// Copyright (c) 2013 Teehan+Lax. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface TLMenuInteractor : UIPercentDrivenInteractiveTransition <UIViewControllerAnimatedTransitioning, UIViewControllerTransitioningDelegate, UIViewControllerInteractiveTransitioning>

-(id)initWithParentViewController:(UIViewController *)viewController;

@property (nonatomic, readonly) UIViewController *parentViewController;

-(void)userDidPan:(UIScreenEdgePanGestureRecognizer *)recognizer;

@end

0 comments on commit 698c35f

Please sign in to comment.