Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial Commit

  • Loading branch information...
commit 5c7b443811cf49e1c7b025571763c44fec0956b0 0 parents
@myell0w authored
Showing with 960 additions and 0 deletions.
  1. +266 −0 MTSlideViewController/MTSlideViewController.xcodeproj/project.pbxproj
  2. +34 −0 MTSlideViewController/MTSlideViewController/MTSlideViewController.h
  3. +480 −0 MTSlideViewController/MTSlideViewController/MTSlideViewController.m
  4. +79 −0 MTSlideViewController/MTSlideViewController/MTSlideViewControllerDefines.h
  5. +24 −0 MTSlideViewController/MTSlideViewController/MTSlideViewTableViewCell.h
  6. +60 −0 MTSlideViewController/MTSlideViewController/MTSlideViewTableViewCell.m
  7. +7 −0 MTSlideViewController/MTSlideViewController/Prefix.pch
  8. BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/cell_background.png
  9. BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/cell_background@2x.png
  10. BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/cell_selected_background.png
  11. BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/cell_selected_background@2x.png
  12. BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/menu_icon.png
  13. BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/menu_icon@2x.png
  14. BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/search_background.png
  15. BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/search_background@2x.png
  16. BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/search_bar_background.png
  17. BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/search_bar_background@2x.png
  18. BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/section_background.png
  19. BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/section_background@2x.png
  20. +10 −0 Readme.mdown
266 MTSlideViewController/MTSlideViewController.xcodeproj/project.pbxproj
@@ -0,0 +1,266 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 9BFF221814B2046B00CF76EE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9BFF221714B2046B00CF76EE /* Foundation.framework */; };
+ 9BFF222914B204BC00CF76EE /* MTSlideViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BFF222414B204BC00CF76EE /* MTSlideViewController.h */; };
+ 9BFF222A14B204BC00CF76EE /* MTSlideViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BFF222514B204BC00CF76EE /* MTSlideViewController.m */; };
+ 9BFF222B14B204BC00CF76EE /* MTSlideViewControllerDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BFF222614B204BC00CF76EE /* MTSlideViewControllerDefines.h */; };
+ 9BFF222C14B204BC00CF76EE /* MTSlideViewTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BFF222714B204BC00CF76EE /* MTSlideViewTableViewCell.h */; };
+ 9BFF222D14B204BC00CF76EE /* MTSlideViewTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BFF222814B204BC00CF76EE /* MTSlideViewTableViewCell.m */; };
+ 9BFF223014B2055F00CF76EE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9BFF222F14B2055F00CF76EE /* UIKit.framework */; };
+ 9BFF223214B2056400CF76EE /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9BFF223114B2056400CF76EE /* CoreGraphics.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 9BFF221414B2046B00CF76EE /* libMTSlideViewController.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMTSlideViewController.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ 9BFF221714B2046B00CF76EE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 9BFF221B14B2046B00CF76EE /* Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = "<group>"; };
+ 9BFF222414B204BC00CF76EE /* MTSlideViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTSlideViewController.h; sourceTree = "<group>"; };
+ 9BFF222514B204BC00CF76EE /* MTSlideViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTSlideViewController.m; sourceTree = "<group>"; };
+ 9BFF222614B204BC00CF76EE /* MTSlideViewControllerDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTSlideViewControllerDefines.h; sourceTree = "<group>"; };
+ 9BFF222714B204BC00CF76EE /* MTSlideViewTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTSlideViewTableViewCell.h; sourceTree = "<group>"; };
+ 9BFF222814B204BC00CF76EE /* MTSlideViewTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTSlideViewTableViewCell.m; sourceTree = "<group>"; };
+ 9BFF222F14B2055F00CF76EE /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 9BFF223114B2056400CF76EE /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 9BFF223314B2058100CF76EE /* MTSlideViewController.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = MTSlideViewController.bundle; path = Resources/MTSlideViewController.bundle; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 9BFF221114B2046B00CF76EE /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 9BFF223214B2056400CF76EE /* CoreGraphics.framework in Frameworks */,
+ 9BFF223014B2055F00CF76EE /* UIKit.framework in Frameworks */,
+ 9BFF221814B2046B00CF76EE /* Foundation.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 9BFF220914B2046B00CF76EE = {
+ isa = PBXGroup;
+ children = (
+ 9BFF221914B2046B00CF76EE /* MTSlideViewController */,
+ 9BFF222E14B2054500CF76EE /* Resources */,
+ 9BFF221614B2046B00CF76EE /* Frameworks */,
+ 9BFF221514B2046B00CF76EE /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 9BFF221514B2046B00CF76EE /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 9BFF221414B2046B00CF76EE /* libMTSlideViewController.a */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 9BFF221614B2046B00CF76EE /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 9BFF223114B2056400CF76EE /* CoreGraphics.framework */,
+ 9BFF222F14B2055F00CF76EE /* UIKit.framework */,
+ 9BFF221714B2046B00CF76EE /* Foundation.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 9BFF221914B2046B00CF76EE /* MTSlideViewController */ = {
+ isa = PBXGroup;
+ children = (
+ 9BFF222414B204BC00CF76EE /* MTSlideViewController.h */,
+ 9BFF222514B204BC00CF76EE /* MTSlideViewController.m */,
+ 9BFF222614B204BC00CF76EE /* MTSlideViewControllerDefines.h */,
+ 9BFF222714B204BC00CF76EE /* MTSlideViewTableViewCell.h */,
+ 9BFF222814B204BC00CF76EE /* MTSlideViewTableViewCell.m */,
+ 9BFF221A14B2046B00CF76EE /* Supporting Files */,
+ );
+ path = MTSlideViewController;
+ sourceTree = "<group>";
+ };
+ 9BFF221A14B2046B00CF76EE /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 9BFF221B14B2046B00CF76EE /* Prefix.pch */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 9BFF222E14B2054500CF76EE /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 9BFF223314B2058100CF76EE /* MTSlideViewController.bundle */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 9BFF221214B2046B00CF76EE /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 9BFF222914B204BC00CF76EE /* MTSlideViewController.h in Headers */,
+ 9BFF222B14B204BC00CF76EE /* MTSlideViewControllerDefines.h in Headers */,
+ 9BFF222C14B204BC00CF76EE /* MTSlideViewTableViewCell.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 9BFF221314B2046B00CF76EE /* MTSlideViewController */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 9BFF222114B2046B00CF76EE /* Build configuration list for PBXNativeTarget "MTSlideViewController" */;
+ buildPhases = (
+ 9BFF221014B2046B00CF76EE /* Sources */,
+ 9BFF221114B2046B00CF76EE /* Frameworks */,
+ 9BFF221214B2046B00CF76EE /* Headers */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = MTSlideViewController;
+ productName = MTSlideViewController;
+ productReference = 9BFF221414B2046B00CF76EE /* libMTSlideViewController.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 9BFF220B14B2046B00CF76EE /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0420;
+ ORGANIZATIONNAME = "NOUS Wissensmanagement GmbH";
+ };
+ buildConfigurationList = 9BFF220E14B2046B00CF76EE /* Build configuration list for PBXProject "MTSlideViewController" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 9BFF220914B2046B00CF76EE;
+ productRefGroup = 9BFF221514B2046B00CF76EE /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 9BFF221314B2046B00CF76EE /* MTSlideViewController */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 9BFF221014B2046B00CF76EE /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 9BFF222A14B204BC00CF76EE /* MTSlideViewController.m in Sources */,
+ 9BFF222D14B204BC00CF76EE /* MTSlideViewTableViewCell.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 9BFF221F14B2046B00CF76EE /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ SDKROOT = iphoneos;
+ };
+ name = Debug;
+ };
+ 9BFF222014B2046B00CF76EE /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ COPY_PHASE_STRIP = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ SDKROOT = iphoneos;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 9BFF222214B2046B00CF76EE /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ DSTROOT = /tmp/MTSlideViewController.dst;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = MTSlideViewController/Prefix.pch;
+ OTHER_LDFLAGS = "-ObjC";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ };
+ name = Debug;
+ };
+ 9BFF222314B2046B00CF76EE /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ DSTROOT = /tmp/MTSlideViewController.dst;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = MTSlideViewController/Prefix.pch;
+ OTHER_LDFLAGS = "-ObjC";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 9BFF220E14B2046B00CF76EE /* Build configuration list for PBXProject "MTSlideViewController" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 9BFF221F14B2046B00CF76EE /* Debug */,
+ 9BFF222014B2046B00CF76EE /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 9BFF222114B2046B00CF76EE /* Build configuration list for PBXNativeTarget "MTSlideViewController" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 9BFF222214B2046B00CF76EE /* Debug */,
+ 9BFF222314B2046B00CF76EE /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 9BFF220B14B2046B00CF76EE /* Project object */;
+}
34 MTSlideViewController/MTSlideViewController/MTSlideViewController.h
@@ -0,0 +1,34 @@
+//
+// MTSlideViewController.h
+// MTSlideViewController
+//
+// Created by Matthias Tretter on 21.01.11.
+// Copyright (c) 2009-2012 Matthias Tretter, @myell0w. All rights reserved.
+// Based on the original work of Andrew Carter: (c) 2001 Andrew Carter
+//
+// 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:
+// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+// 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.
+
+#import <UIKit/UIKit.h>
+#import "MTSlideViewControllerDefines.h"
+
+@interface MTSlideViewController : UIViewController
+
+@property (nonatomic, strong, readonly) UITableView *tableView;
+@property (nonatomic, weak) id <MTSlideViewControllerDelegate> delegate;
+@property (nonatomic, weak) id <MTSlideViewControllerDataSource> dataSource;
+@property (nonatomic, assign) BOOL slideOnNavigationBarOnly;
+
+
+- (void)slideOutSlideNavigationControllerView;
+- (void)slideInSlideNavigationControllerView;
+- (void)slideSlideNavigationControllerViewOffScreen;
+
+- (void)cancelSearching;
+
+@end
480 MTSlideViewController/MTSlideViewController/MTSlideViewController.m
@@ -0,0 +1,480 @@
+#import "MTSlideViewController.h"
+#import "MTSlideViewTableViewCell.h"
+#import <QuartzCore/QuartzCore.h>
+
+#define kMTLeftAnchorX 100.0f
+#define kMTRightAnchorX 190.0f
+#define kMTSlideAnimationDuration 0.2
+
+
+@interface MTSlideViewController () <UITableViewDelegate, UITableViewDataSource, UINavigationControllerDelegate, UISearchBarDelegate, UITextFieldDelegate> {
+ BOOL rotationEnabled_;
+ CGPoint startingDragPoint_;
+ CGFloat startingDragTransformTx_;
+}
+
+@property (nonatomic, strong, readwrite) IBOutlet UITableView *tableView;
+@property (nonatomic, strong) IBOutlet UINavigationController *slideNavigationController;
+@property (nonatomic, strong) IBOutlet UISearchBar *searchBar;
+@property (nonatomic, strong) IBOutlet UIImageView *searchBarBackgroundView;
+@property (nonatomic, assign) MTSlideNavigationControllerState slideNavigationControllerState;
+
+- (void)configureViewController:(UIViewController *)viewController;
+- (void)menuBarButtonItemPressed:(id)sender;
+- (void)handleNavigationBarPan:(UIPanGestureRecognizer *)gestureRecognizer;
+
+- (void)handleTouchesBeganAtLocation:(CGPoint)location;
+- (void)handleTouchesMovedToLocation:(CGPoint)location;
+- (void)handleTouchesEndedAtLocation:(CGPoint)location;
+
+@end
+
+@implementation MTSlideViewController
+
+@synthesize slideNavigationController = slideNavigationController_;
+@synthesize searchBar = searchBar_;
+@synthesize searchBarBackgroundView = searchBarBackgroundView_;
+@synthesize tableView = tableView_;
+@synthesize slideNavigationControllerState = slideNavigationControllerState_;
+@synthesize delegate = delegate_;
+@synthesize dataSource = dataSource_;
+@synthesize slideOnNavigationBarOnly = slideOnNavigationBarOnly_;
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - Lifecycle
+////////////////////////////////////////////////////////////////////////
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
+ if ((self = [super initWithNibName:nibNameOrNil bundle:nil])) {
+ rotationEnabled_ = YES;
+ slideOnNavigationBarOnly_ = NO;
+ slideNavigationControllerState_ = MTSlideNavigationControllerStateNormal;
+ }
+
+ return self;
+}
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - UIViewController
+////////////////////////////////////////////////////////////////////////
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+
+ searchBarBackgroundView_ = [[UIImageView alloc] initWithFrame:CGRectMake(0.f, 0.f, 320.f, 44.f)];
+ searchBarBackgroundView_.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+ [self.view addSubview:searchBarBackgroundView_];
+
+ searchBar_ = [[UISearchBar alloc] initWithFrame:searchBarBackgroundView_.frame];
+ searchBar_.delegate = self;
+ searchBar_.showsCancelButton = YES;
+ searchBar_.tintColor = [UIColor colorWithRed:36.f/255.f green:43.f/255.f blue:57.f/255.f alpha:1.f];
+ [self.view addSubview:searchBar_];
+
+ tableView_ = [[UITableView alloc] initWithFrame:CGRectMake(0.f, 44.f, 320.f, self.view.bounds.size.height-44.f) style:UITableViewStylePlain];
+ tableView_.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ tableView_.backgroundColor = [UIColor colorWithRed:50.f/255.f green:57.f/255.f blue:74.f/255.f alpha:1.f];
+ tableView_.separatorStyle = UITableViewCellSeparatorStyleNone;
+ tableView_.delegate = self;
+ tableView_.dataSource = self;
+ [self.view addSubview:tableView_];
+
+ if (![self.dataSource respondsToSelector:@selector(slideViewController:searchTermDidChange:)] ||
+ ![self.dataSource respondsToSelector:@selector(searchDatasourceForSlideViewController:)]) {
+ searchBar_.hidden = YES;
+ searchBarBackgroundView_.hidden = YES;
+ tableView_.frame = CGRectMake(0.0f, 0.0f, 320.0f, self.view.bounds.size.height);
+ }
+
+ UIViewController *initalViewController = [self.dataSource initialViewControllerForSlideViewController:self];
+ [self configureViewController:initalViewController];
+
+ slideNavigationController_ = [[UINavigationController alloc] initWithRootViewController:initalViewController];
+ slideNavigationController_.delegate = self;
+ slideNavigationController_.view.layer.shadowColor = [[UIColor blackColor] CGColor];
+ slideNavigationController_.view.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
+ slideNavigationController_.view.layer.shadowRadius = 4.0f;
+ slideNavigationController_.view.layer.shadowOpacity = 0.75f;
+ [slideNavigationController_ willMoveToParentViewController:self];
+ [self addChildViewController:slideNavigationController_];
+ [self.view addSubview:slideNavigationController_.view];
+ [slideNavigationController_ didMoveToParentViewController:self];
+
+ UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:slideNavigationController_.view.bounds cornerRadius:4.0];
+ slideNavigationController_.view.layer.shadowPath = path.CGPath;
+
+ UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleNavigationBarPan:)];
+ [slideNavigationController_.navigationBar addGestureRecognizer:panRecognizer];
+
+ UIImage *searchBarBackground = [UIImage imageNamed:@"MTSlideViewController.bundle/search_bar_background"];
+ [searchBar_ setBackgroundImage:[searchBarBackground stretchableImageWithLeftCapWidth:0 topCapHeight:0]];
+ searchBarBackgroundView_.image = [searchBarBackground stretchableImageWithLeftCapWidth:0 topCapHeight:0];
+ searchBar_.placeholder = NSLocalizedString(@"Search", @"Search");
+
+
+ if ([self.dataSource respondsToSelector:@selector(initialSelectedIndexPathForSlideViewController:)]) {
+ [tableView_ selectRowAtIndexPath:[self.dataSource initialSelectedIndexPathForSlideViewController:self]
+ animated:NO
+ scrollPosition:UITableViewScrollPositionTop];
+ }
+}
+
+- (void)viewDidUnload {
+ [super viewDidUnload];
+
+ self.searchBar = nil;
+ self.searchBarBackgroundView = nil;
+ self.tableView = nil;
+ self.slideNavigationController = nil;
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
+ return rotationEnabled_ && toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
+}
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - SlideViewController
+////////////////////////////////////////////////////////////////////////
+
+- (void)configureViewController:(UIViewController *)viewController {
+ UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"MTSlideViewController.bundle/menu_icon"]
+ style:UIBarButtonItemStylePlain
+ target:self
+ action:@selector(menuBarButtonItemPressed:)];
+
+ viewController.navigationItem.leftBarButtonItem = barButtonItem;
+}
+
+- (void)menuBarButtonItemPressed:(id)sender {
+ if (slideNavigationControllerState_ == MTSlideNavigationControllerStatePeeking) {
+ [self slideInSlideNavigationControllerView];
+ return;
+ }
+
+ UIViewController *currentViewController = [[slideNavigationController_ viewControllers] objectAtIndex:0];
+
+ if ([currentViewController conformsToProtocol:@protocol(MTSlideViewControllerSlideDelegate)]
+ && [currentViewController respondsToSelector:@selector(shouldSlideOut)]) {
+ if ([(id <MTSlideViewControllerSlideDelegate>)currentViewController shouldSlideOut]) {
+ [self slideOutSlideNavigationControllerView];
+ }
+ } else {
+ [self slideOutSlideNavigationControllerView];
+ }
+}
+
+- (void)slideOutSlideNavigationControllerView {
+ slideNavigationControllerState_ = MTSlideNavigationControllerStatePeeking;
+
+ slideNavigationController_.topViewController.view.userInteractionEnabled = NO;
+ [UIView animateWithDuration:kMTSlideAnimationDuration
+ delay:0.0f
+ options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState
+ animations:^{
+ slideNavigationController_.view.transform = CGAffineTransformMakeTranslation(260.f, 0.f);
+ } completion:^(BOOL finished) {
+ searchBar_.frame = CGRectMake(0.f, 0.f, 320.f, searchBar_.frame.size.height);
+ }];
+}
+
+- (void)slideInSlideNavigationControllerView {
+ [UIView animateWithDuration:kMTSlideAnimationDuration
+ delay:0.0f
+ options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState
+ animations:^{
+ slideNavigationController_.view.transform = CGAffineTransformIdentity;
+ } completion:^(BOOL finished) {
+ slideNavigationController_.topViewController.view.userInteractionEnabled = YES;
+ [self cancelSearching];
+ slideNavigationControllerState_ = MTSlideNavigationControllerStateNormal;
+ }];
+}
+
+- (void)slideSlideNavigationControllerViewOffScreen {
+ slideNavigationControllerState_ = MTSlideNavigationControllerStateSearching;
+
+ [UIView animateWithDuration:kMTSlideAnimationDuration
+ delay:0.0f
+ options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState
+ animations:^{
+ CGFloat width = UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation) ? 480.f : 320.f;
+
+ slideNavigationController_.view.transform = CGAffineTransformMakeTranslation(width, 0.0f);
+ searchBar_.frame = CGRectMake(0.f, 0.f, width, searchBar_.frame.size.height);
+
+ } completion:nil];
+}
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - UIGestureRecognizer
+////////////////////////////////////////////////////////////////////////
+
+- (void)handleNavigationBarPan:(UIPanGestureRecognizer *)gestureRecognizer {
+ if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
+ [self handleTouchesBeganAtLocation:[gestureRecognizer locationInView:self.view]];
+ } else if (gestureRecognizer.state == UIGestureRecognizerStateChanged) {
+ [self handleTouchesMovedToLocation:[gestureRecognizer locationInView:self.view]];
+ } else if (gestureRecognizer.state == UIGestureRecognizerStateEnded ||
+ gestureRecognizer.state == UIGestureRecognizerStateCancelled ||
+ gestureRecognizer.state == UIGestureRecognizerStateFailed) {
+ [self handleTouchesEndedAtLocation:[gestureRecognizer locationInView:self.view]];
+ }
+}
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - UITouch Handling
+////////////////////////////////////////////////////////////////////////
+
+- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
+ UITouch *touch = [touches anyObject];
+ [self handleTouchesBeganAtLocation:[touch locationInView:self.view]];
+}
+
+- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
+ UITouch *touch = [touches anyObject];
+ [self handleTouchesMovedToLocation:[touch locationInView:self.view]];
+}
+
+- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
+ UITouch *touch = [touches anyObject];
+ [self handleTouchesEndedAtLocation:[touch locationInView:self.view]];
+}
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - UINavigationControllerDelegate
+////////////////////////////////////////////////////////////////////////
+
+- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
+ [self cancelSearching];
+
+ if ([navigationController viewControllers].count > 1) {
+ slideNavigationControllerState_ = MTSlideNavigationControllerStateDrilledDown;
+ } else {
+ slideNavigationControllerState_ = MTSlideNavigationControllerStateNormal;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - UITableViewDataSource
+////////////////////////////////////////////////////////////////////////
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ if (slideNavigationControllerState_ == MTSlideNavigationControllerStateSearching) {
+ return [self.dataSource searchDatasourceForSlideViewController:self].count;
+ } else {
+ return [[[[self.dataSource datasourceForSlideViewController:self] objectAtIndex:section] objectForKey:kMTSlideViewControllerSectionViewControllersKey] count];
+ }
+}
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+ if (slideNavigationControllerState_ == MTSlideNavigationControllerStateSearching) {
+ return 1;
+ } else {
+ return [self.dataSource datasourceForSlideViewController:self].count;
+ }
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ MTSlideViewTableViewCell *cell = [MTSlideViewTableViewCell cellForTableView:tableView style:UITableViewCellStyleDefault ];
+ NSDictionary *viewControllerDictionary = nil;
+
+ if (slideNavigationControllerState_ == MTSlideNavigationControllerStateSearching) {
+ viewControllerDictionary = [[self.dataSource searchDatasourceForSlideViewController:self] objectAtIndex:indexPath.row];
+ } else {
+ viewControllerDictionary = [[[[self.dataSource datasourceForSlideViewController:self] objectAtIndex:indexPath.section] objectForKey:kMTSlideViewControllerSectionViewControllersKey] objectAtIndex:indexPath.row];
+ }
+
+ cell.textLabel.text = [viewControllerDictionary objectForKey:kMTSlideViewControllerViewControllerTitleKey];
+
+ if ([[viewControllerDictionary objectForKey:kMTSlideViewControllerViewControllerIconKey] isKindOfClass:[UIImage class]]) {
+ cell.imageView.image = [viewControllerDictionary objectForKey:kMTSlideViewControllerViewControllerIconKey];
+ } else {
+ cell.imageView.image = nil;
+ }
+
+ return cell;
+}
+
+- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
+ if (slideNavigationControllerState_ == MTSlideNavigationControllerStateSearching) {
+ return nil;
+ }
+
+ NSDictionary *sectionDictionary = [[self.dataSource datasourceForSlideViewController:self] objectAtIndex:section];
+
+ if ([sectionDictionary objectForKey:kMTSlideViewControllerSectionTitleKey]) {
+ NSString *sectionTitle = [sectionDictionary objectForKey:kMTSlideViewControllerSectionTitleKey];
+
+ if ([sectionTitle isEqualToString:kMTSlideViewControllerSectionTitleNoTitle]) {
+ return nil;
+ } else {
+ return sectionTitle;
+ }
+ } else {
+ return nil;
+ }
+}
+
+- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
+ if (slideNavigationControllerState_ == MTSlideNavigationControllerStateSearching) {
+ return nil;
+ }
+
+ NSString *titleString = [self tableView:tableView titleForHeaderInSection:section];
+
+ if (titleString == nil) {
+ return nil;
+ }
+
+ UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, tableView.bounds.size.width, 22.0f)];
+ imageView.image = [[UIImage imageNamed:@"MTSlideViewController.bundle/section_background"] stretchableImageWithLeftCapWidth:0.0f topCapHeight:0.0f];
+
+ UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectInset(imageView.frame, 10.0f, 0.0f)];
+ titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:12.0f];
+ titleLabel.textAlignment = UITextAlignmentLeft;
+ titleLabel.textColor = [UIColor colorWithRed:125.0f/255.0f green:129.0f/255.0f blue:146.0f/255.0f alpha:1.0f];
+ titleLabel.shadowColor = [UIColor colorWithRed:40.0f/255.0f green:45.0f/255.0f blue:57.0f/255.0f alpha:1.0f];
+ titleLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
+ titleLabel.backgroundColor = [UIColor clearColor];
+ titleLabel.text = titleString;
+ [imageView addSubview:titleLabel];
+
+ return imageView;
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
+ if (slideNavigationControllerState_ == MTSlideNavigationControllerStateSearching) {
+ return 0.0f;
+ } else if ([self tableView:tableView titleForHeaderInSection:section]) {
+ return 22.0f;
+ } else {
+ return 0.0f;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - UITableViewDelegate
+////////////////////////////////////////////////////////////////////////
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+ NSDictionary *viewControllerDictionary = nil;
+
+ if (slideNavigationControllerState_ == MTSlideNavigationControllerStateSearching) {
+ viewControllerDictionary = [[self.dataSource searchDatasourceForSlideViewController:self] objectAtIndex:indexPath.row];
+ } else {
+ viewControllerDictionary = [[[[self.dataSource datasourceForSlideViewController:self] objectAtIndex:indexPath.section] objectForKey:kMTSlideViewControllerSectionViewControllersKey] objectAtIndex:indexPath.row];
+ }
+
+ id viewController = [viewControllerDictionary objectForKey:kMTSlideViewControllerViewControllerKey];
+
+ if ([self.delegate respondsToSelector:@selector(slideViewController:didSelectViewController:atIndexPath:)]) {
+ [self.delegate slideViewController:self
+ didSelectViewController:viewController
+ atIndexPath:indexPath];
+ }
+
+ [self configureViewController:viewController];
+ [slideNavigationController_ setViewControllers:[NSArray arrayWithObject:viewController] animated:NO];
+ [self slideInSlideNavigationControllerView];
+}
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - UISearchBarDelegate
+////////////////////////////////////////////////////////////////////////
+
+- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
+ if ([self.dataSource respondsToSelector:@selector(slideViewController:searchTermDidChange:)]) {
+ [self slideSlideNavigationControllerViewOffScreen];
+ [self.dataSource slideViewController:self searchTermDidChange:searchBar.text];
+ [tableView_ reloadData];
+ }
+
+ rotationEnabled_ = NO;
+}
+
+- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
+ if ([self.dataSource respondsToSelector:@selector(slideViewController:searchTermDidChange:)]) {
+ [self.dataSource slideViewController:self searchTermDidChange:searchBar.text];
+ [tableView_ reloadData];
+ }
+}
+
+- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar {
+ rotationEnabled_ = YES;
+}
+
+- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
+ [self cancelSearching];
+ [self slideOutSlideNavigationControllerView];
+ [tableView_ reloadData];
+ rotationEnabled_ = YES;
+}
+
+- (void)cancelSearching {
+ if (slideNavigationControllerState_ == MTSlideNavigationControllerStateSearching) {
+ [searchBar_ resignFirstResponder];
+ slideNavigationControllerState_ = MTSlideNavigationControllerStateNormal;
+ searchBar_.text = @"";
+ [tableView_ reloadData];
+ }
+}
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - Private
+////////////////////////////////////////////////////////////////////////
+
+- (void)handleTouchesBeganAtLocation:(CGPoint)location {
+ if (slideNavigationControllerState_ == MTSlideNavigationControllerStateDrilledDown
+ || slideNavigationControllerState_ == MTSlideNavigationControllerStateSearching) {
+ return;
+ }
+
+ startingDragPoint_ = location;
+
+ if ((CGRectContainsPoint(slideNavigationController_.view.frame, startingDragPoint_)) &&
+ slideNavigationControllerState_ == MTSlideNavigationControllerStatePeeking) {
+ slideNavigationControllerState_ = MTSlideNavigationControllerStateDragging;
+ startingDragTransformTx_ = slideNavigationController_.view.transform.tx;
+ }
+
+ // we only trigger a swipe if either navigationBarOnly is deactivated
+ // or we swiped in the navigationBar
+ if (!self.slideOnNavigationBarOnly || startingDragPoint_.y <= self.slideNavigationController.navigationBar.frame.size.height) {
+ slideNavigationControllerState_ = MTSlideNavigationControllerStateDragging;
+ startingDragTransformTx_ = slideNavigationController_.view.transform.tx;
+ }
+}
+
+- (void)handleTouchesMovedToLocation:(CGPoint)location {
+ if (slideNavigationControllerState_ != MTSlideNavigationControllerStateDragging) {
+ return;
+ }
+
+ [UIView animateWithDuration:0.05f
+ delay:0.0f
+ options:UIViewAnimationOptionCurveLinear | UIViewAnimationOptionBeginFromCurrentState
+ animations:^{
+ slideNavigationController_.view.transform = CGAffineTransformMakeTranslation(MAX(startingDragTransformTx_ + (location.x - startingDragPoint_.x), 0.0f), 0.0f);
+ } completion:nil];
+}
+
+- (void)handleTouchesEndedAtLocation:(CGPoint)location {
+ if (slideNavigationControllerState_ == MTSlideNavigationControllerStateDragging) {
+ // Check in which direction we were dragging
+ if (location.x < startingDragPoint_.x) {
+ if (slideNavigationController_.view.transform.tx <= kMTRightAnchorX) {
+ [self slideInSlideNavigationControllerView];
+ } else {
+ [self slideOutSlideNavigationControllerView];
+ }
+ } else {
+ if (slideNavigationController_.view.transform.tx >= kMTLeftAnchorX) {
+ [self slideOutSlideNavigationControllerView];
+ } else {
+ [self slideInSlideNavigationControllerView];
+ }
+ }
+ }
+}
+
+@end
79 MTSlideViewController/MTSlideViewController/MTSlideViewControllerDefines.h
@@ -0,0 +1,79 @@
+//
+// MTSlideViewControllerDefines.h
+// MTSlideViewController
+//
+// Created by Matthias Tretter on 21.01.11.
+// Copyright (c) 2009-2012 Matthias Tretter, @myell0w. All rights reserved.
+// Based on the original work of Andrew Carter: (c) 2001 Andrew Carter
+//
+// 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:
+// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+// 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.
+
+#import <UIKit/UIKit.h>
+
+@class MTSlideViewController;
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - Defines
+////////////////////////////////////////////////////////////////////////
+
+#define kMTSlideViewControllerSectionTitleKey @"MTSlideViewControllerSectionTitleKey"
+#define kMTSlideViewControllerSectionTitleNoTitle @"MTSlideViewControllerSectionTitleNoTitle"
+#define kMTSlideViewControllerSectionViewControllersKey @"MTSlideViewControllerSectionViewControllersKey"
+#define kMTSlideViewControllerViewControllerTitleKey @"MTSlideViewControllerViewControllerTitleKey"
+#define kMTSlideViewControllerViewControllerIconKey @"MTSlideViewControllerViewControllerIconKey"
+#define kMTSlideViewControllerViewControllerKey @"MTSlideViewControllerViewControllerKey"
+
+typedef enum {
+ MTSlideNavigationControllerStateNormal = 0,
+ MTSlideNavigationControllerStateDragging,
+ MTSlideNavigationControllerStatePeeking,
+ MTSlideNavigationControllerStateDrilledDown,
+ MTSlideNavigationControllerStateSearching
+} MTSlideNavigationControllerState;
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - MTSlideViewControllerDataSource
+////////////////////////////////////////////////////////////////////////
+
+@protocol MTSlideViewControllerDataSource <NSObject>
+
+@optional
+- (NSIndexPath *)initialSelectedIndexPathForSlideViewController:(MTSlideViewController *)slideViewController;
+- (void)slideViewController:(MTSlideViewController *)slideViewController searchTermDidChange:(NSString *)searchTerm;
+- (NSArray *)searchDatasourceForSlideViewController:(MTSlideViewController *)slideViewController;
+
+@required
+- (UIViewController *)initialViewControllerForSlideViewController:(MTSlideViewController *)slideViewController;
+- (NSArray *)datasourceForSlideViewController:(MTSlideViewController *)slideViewController;
+
+@end
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - MTSlideViewControllerDelegate
+////////////////////////////////////////////////////////////////////////
+
+@protocol MTSlideViewControllerDelegate <NSObject>
+
+@optional
+- (void)slideViewController:(MTSlideViewController *)slideViewController
+ didSelectViewController:(UIViewController *)viewController
+ atIndexPath:(NSIndexPath *)indexPath;
+
+@end
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - MTSlideViewControllerSlideDelegate
+////////////////////////////////////////////////////////////////////////
+
+@protocol MTSlideViewControllerSlideDelegate <NSObject>
+
+@optional
+- (BOOL)shouldSlideOut;
+
+@end
24 MTSlideViewController/MTSlideViewController/MTSlideViewTableViewCell.h
@@ -0,0 +1,24 @@
+//
+// MTSlideViewTableViewCell.h
+// MTSlideViewController
+//
+// Created by Matthias Tretter on 21.01.11.
+// Copyright (c) 2009-2012 Matthias Tretter, @myell0w. All rights reserved.
+// Based on the original work of Andrew Carter: (c) 2001 Andrew Carter
+//
+// 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:
+// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+// 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.
+
+#import <UIKit/UIKit.h>
+
+@interface MTSlideViewTableViewCell : UITableViewCell
+
++ (NSString *)cellIdentifier;
++ (id)cellForTableView:(UITableView *)tableView style:(UITableViewCellStyle)cellStyle;
+
+@end
60 MTSlideViewController/MTSlideViewController/MTSlideViewTableViewCell.m
@@ -0,0 +1,60 @@
+#import "MTSlideViewTableViewCell.h"
+
+@implementation MTSlideViewTableViewCell
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - Lifecycle
+////////////////////////////////////////////////////////////////////////
+
++ (NSString *)cellIdentifier {
+ return NSStringFromClass([self class]);
+}
+
++ (id)cellForTableView:(UITableView *)tableView style:(UITableViewCellStyle)cellStyle {
+ NSString *cellID = [NSString stringWithFormat:@"%@_%d", [self cellIdentifier], cellStyle];
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
+
+ if (cell == nil) {
+ cell = [[self alloc] initWithStyle:cellStyle reuseIdentifier:cellID];
+ }
+
+ return cell;
+}
+
+- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
+ if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
+ UIImageView *background = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 44.0f)];
+ [background setImage:[[UIImage imageNamed:@"MTSlideViewController.bundle/cell_background"] stretchableImageWithLeftCapWidth:0.0f topCapHeight:0.0f]];
+ self.backgroundView = background;
+
+ UIImageView *selectedBackground = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 44.0f)];
+ [selectedBackground setImage:[[UIImage imageNamed:@"MTSlideViewController.bundle/cell_selected_background"] stretchableImageWithLeftCapWidth:0.0f topCapHeight:0.0f]];
+ self.selectedBackgroundView = selectedBackground;
+
+ self.textLabel.textColor = [UIColor colorWithRed:190.0f/255.0f green:197.0f/255.0f blue:212.0f/255.0f alpha:1.0f];
+ self.textLabel.highlightedTextColor = self.textLabel.textColor;
+ self.textLabel.shadowColor = [UIColor colorWithRed:33.0f/255.0f green:38.0f/255.0f blue:49.0f/255.0f alpha:1.0f];
+ self.textLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
+ self.textLabel.backgroundColor = [UIColor clearColor];
+ self.textLabel.font = [UIFont fontWithName:@"Helvetica" size:16.0f];
+
+ self.imageView.clipsToBounds = YES;
+ self.imageView.contentMode = UIViewContentModeScaleAspectFit;
+
+ }
+
+ return self;
+}
+
+////////////////////////////////////////////////////////////////////////
+#pragma mark - UIView
+////////////////////////////////////////////////////////////////////////
+
+- (void)layoutSubviews {
+ [super layoutSubviews];
+
+ self.imageView.frame = CGRectMake(5.0f, 5.0f, 34.0f, 34.0f);
+
+}
+
+@end
7 MTSlideViewController/MTSlideViewController/Prefix.pch
@@ -0,0 +1,7 @@
+//
+// Prefix header for all source files of the 'MTSlideViewController' target in the 'MTSlideViewController' project
+//
+
+#ifdef __OBJC__
+ #import <Foundation/Foundation.h>
+#endif
BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/cell_background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/cell_background@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/cell_selected_background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/cell_selected_background@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/menu_icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/menu_icon@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/search_background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/search_background@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/search_bar_background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/search_bar_background@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/section_background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  MTSlideViewController/Resources/MTSlideViewController.bundle/section_background@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 Readme.mdown
@@ -0,0 +1,10 @@
+Read Me
+=====================
+
+MTSlideViewController tries to mimic Facebook's and Path's sliding navigation concept for the iPhone. It is iOS 5 only and built usinc ARC.
+MTSlideViewController is initally based on Andrew Roy Carter's [SlideViewController](https://github.com/andrewroycarter/SlideViewController "SlideViewController") and got modiefied to support rotation, ARC and lots of small improvements.
+
+Screenshots
+-------------------
+
+![Screenshot: Launch image](https://img.skitch.com/20120102-m6nt5nt5dy2sarqsd7x923dpjr.jpg)

0 comments on commit 5c7b443

Please sign in to comment.
Something went wrong with that request. Please try again.