├── .DS_Store ├── .gitignore ├── LICENSE.txt ├── README.md ├── SCSlidingViewController.podspec └── SCSlidingViewController ├── SCSlidingViewControllerDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── SCSlidingViewControllerDemo.xccheckout │ └── xcuserdata │ │ └── simon.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── simon.xcuserdatad │ └── xcschemes │ ├── SCSlidingViewControllerDemo.xcscheme │ └── xcschememanagement.plist ├── SCSlidingViewControllerDemo ├── AppDelegate.h ├── AppDelegate.m ├── Classes │ ├── MenuViewController.h │ ├── MenuViewController.m │ ├── RightMenuViewController.h │ ├── RightMenuViewController.m │ ├── RootViewController.h │ ├── RootViewController.m │ ├── TopViewController.h │ └── TopViewController.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── SCSlidingViewController │ ├── SCSlidingViewController.h │ └── SCSlidingViewController.m ├── SCSlidingViewControllerDemo-Info.plist ├── SCSlidingViewControllerDemo-Prefix.pch ├── Storyboard.storyboard ├── en.lproj │ └── InfoPlist.strings └── main.m └── SCSlidingViewControllerDemoTests ├── SCSlidingViewControllerDemoTests-Info.plist ├── SCSlidingViewControllerDemoTests.m └── en.lproj └── InfoPlist.strings /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoncoulton/SCSlidingViewController/e400b9a16024d2a486a806b5c510a7dff74e1271/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Simon Coulton 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SCSlidingViewController 2 | 3 | After seeing the following Dribbble shot, I figured it was probably the best solution for the sliding view controller on iOS7. 4 | 5 | ![Dribble](http://dribbble.s3.amazonaws.com/users/14827/screenshots/1193991/8.png "Dribble") 6 | 7 | SCSlidingViewController allows you to set one (or two) view controllers to be full height on iOS7 so that the color behind the statusbar can be controlled, while the top view sits below the status bar as per iOS6. 8 | 9 | ## Usage 10 | 11 | In your `RootViewController.m`, do the following to instantiate the left and right (either can be omitted) sides. 12 | 13 | #import "RootViewController.h" 14 | #import "TopViewController.h" 15 | #import "MenuViewController.h" 16 | 17 | @interface RootViewController () 18 | 19 | @end 20 | 21 | @implementation RootViewController 22 | 23 | 24 | - (void)viewDidLoad 25 | { 26 | // Initial view controller, setup the views to be used. 27 | [super viewDidLoad]; 28 | self.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Top"]; 29 | self.leftSideViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Menu"]; 30 | self.rightSideViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Context"]; 31 | } 32 | 33 | @end 34 | 35 | In your `RootViewController.h` file, make sure you subclass SCSlidingViewController 36 | 37 | #import 38 | #import "SCSlidingViewController.h" 39 | 40 | @interface RootViewController : SCSlidingViewController 41 | 42 | @end 43 | 44 | From any of your other view controllers, when you want to change the topViewController, simply call: 45 | 46 | [self.slidingViewController changeTopViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"YOUR VIEW CONTROLLER NAME"]]; 47 | 48 | ### Customizing the top view 49 | 50 | The following are exposed (and should be straight forward in terms of functionality). 51 | 52 | @property (nonatomic) BOOL allowOverswipe; 53 | @property (nonatomic) int topViewOffsetY; 54 | @property (nonatomic) int peakAmount; 55 | @property (nonatomic) CGFloat peakThreshold; 56 | @property (nonatomic) CGFloat cornerRadius; 57 | @property (nonatomic) CGFloat shadowOpacity; 58 | @property (nonatomic) CGFloat shadowOffsetX; 59 | @property (nonatomic) CGFloat shadowOffsetY; 60 | @property (retain, nonatomic) UIColor *shadowColor; 61 | @property (nonatomic) CGFloat animationDuration; 62 | 63 | `peakThreshold` will affect the panning gesture when opening a side. If the view controller is panned more than the percentage amount of the window frame width minus the visible amount of the view controller when being peaked, the view controller will be displayed, otherwise the top view controller will snap back to the original position. 64 | 65 | `allowOverswipe` prevents the view controller from displaying the opposite side from being viewable when panning. 66 | 67 | ### Events 68 | 69 | The following events are called when the top view is changed (but are not triggered via self.topViewController modifications). 70 | 71 | - (void)willChangeTopViewController; 72 | - (void)didChangeTopViewController; 73 | 74 | 75 | ## Todo 76 | 77 | 1. Test on iOS6, though some small preliminary tests have been done and it seems to work. 78 | 2. Ability to round corners of content in UINavigationController 79 | 80 | [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/simoncoulton/scslidingviewcontroller/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 81 | -------------------------------------------------------------------------------- /SCSlidingViewController.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "SCSlidingViewController" 4 | s.version = "1.1.0" 5 | s.summary = "A sliding UIViewController for iOS7." 6 | 7 | s.description = <<-DESC 8 | SCSlidingViewController allows you to set one (or two) view controllers to be full height on iOS7 so that the color behind the statusbar can be controlled, while the top view sits below the status bar as per iOS6. See the screenshot for an example of how it would appear. 9 | DESC 10 | 11 | s.homepage = "https://github.com/simoncoulton/SCSlidingViewController" 12 | s.screenshots = "http://dribbble.s3.amazonaws.com/users/14827/screenshots/1193991/8.png" 13 | s.license = { :type => 'MIT', :file => 'LICENSE.txt' } 14 | s.author = { "Simon Coulton" => "simon.coulton@gmail.com" } 15 | s.platform = :ios, '6.1' 16 | s.source = { :git => "https://github.com/simoncoulton/SCSlidingViewController.git", :tag => "1.1.0" } 17 | s.source_files = 'SCSlidingViewController/SCSlidingViewControllerDemo/SCSlidingViewController', 'SCSlidingViewController/SCSlidingViewControllerDemo/SCSlidingViewController/*.{h,m}' 18 | s.exclude_files = 'Classes/Exclude' 19 | 20 | end 21 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F407F2471828EF7A00A2753E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F407F2461828EF7A00A2753E /* Foundation.framework */; }; 11 | F407F2491828EF7A00A2753E /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F407F2481828EF7A00A2753E /* CoreGraphics.framework */; }; 12 | F407F24B1828EF7A00A2753E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F407F24A1828EF7A00A2753E /* UIKit.framework */; }; 13 | F407F2511828EF7A00A2753E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F407F24F1828EF7A00A2753E /* InfoPlist.strings */; }; 14 | F407F2531828EF7A00A2753E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F407F2521828EF7A00A2753E /* main.m */; }; 15 | F407F2571828EF7A00A2753E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F407F2561828EF7A00A2753E /* AppDelegate.m */; }; 16 | F407F2591828EF7A00A2753E /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F407F2581828EF7A00A2753E /* Images.xcassets */; }; 17 | F407F2601828EF7A00A2753E /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F407F25F1828EF7A00A2753E /* XCTest.framework */; }; 18 | F407F2611828EF7A00A2753E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F407F2461828EF7A00A2753E /* Foundation.framework */; }; 19 | F407F2621828EF7A00A2753E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F407F24A1828EF7A00A2753E /* UIKit.framework */; }; 20 | F407F26A1828EF7A00A2753E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F407F2681828EF7A00A2753E /* InfoPlist.strings */; }; 21 | F407F26C1828EF7A00A2753E /* SCSlidingViewControllerDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F407F26B1828EF7A00A2753E /* SCSlidingViewControllerDemoTests.m */; }; 22 | F407F2761828F04500A2753E /* Storyboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F407F2751828F04500A2753E /* Storyboard.storyboard */; }; 23 | F407F27A1829B2A400A2753E /* SCSlidingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F407F2791829B2A400A2753E /* SCSlidingViewController.m */; }; 24 | F407F27E1829B3F000A2753E /* MenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F407F27D1829B3F000A2753E /* MenuViewController.m */; }; 25 | F407F2811829B46100A2753E /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F407F2801829B46100A2753E /* RootViewController.m */; }; 26 | F407F2841829B66200A2753E /* TopViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F407F2831829B66200A2753E /* TopViewController.m */; }; 27 | F4CCDB8A1829DA0400972C71 /* RightMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F4CCDB891829DA0400972C71 /* RightMenuViewController.m */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXContainerItemProxy section */ 31 | F407F2631828EF7A00A2753E /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = F407F23B1828EF7A00A2753E /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = F407F2421828EF7A00A2753E; 36 | remoteInfo = SCSlidingViewControllerDemo; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | F407F2431828EF7A00A2753E /* SCSlidingViewControllerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SCSlidingViewControllerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | F407F2461828EF7A00A2753E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 43 | F407F2481828EF7A00A2753E /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 44 | F407F24A1828EF7A00A2753E /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 45 | F407F24E1828EF7A00A2753E /* SCSlidingViewControllerDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SCSlidingViewControllerDemo-Info.plist"; sourceTree = ""; }; 46 | F407F2501828EF7A00A2753E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 47 | F407F2521828EF7A00A2753E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 48 | F407F2541828EF7A00A2753E /* SCSlidingViewControllerDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SCSlidingViewControllerDemo-Prefix.pch"; sourceTree = ""; }; 49 | F407F2551828EF7A00A2753E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 50 | F407F2561828EF7A00A2753E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 51 | F407F2581828EF7A00A2753E /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 52 | F407F25E1828EF7A00A2753E /* SCSlidingViewControllerDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SCSlidingViewControllerDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | F407F25F1828EF7A00A2753E /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 54 | F407F2671828EF7A00A2753E /* SCSlidingViewControllerDemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SCSlidingViewControllerDemoTests-Info.plist"; sourceTree = ""; }; 55 | F407F2691828EF7A00A2753E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 56 | F407F26B1828EF7A00A2753E /* SCSlidingViewControllerDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SCSlidingViewControllerDemoTests.m; sourceTree = ""; }; 57 | F407F2751828F04500A2753E /* Storyboard.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Storyboard.storyboard; sourceTree = ""; }; 58 | F407F2781829B2A400A2753E /* SCSlidingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCSlidingViewController.h; sourceTree = ""; }; 59 | F407F2791829B2A400A2753E /* SCSlidingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCSlidingViewController.m; sourceTree = ""; }; 60 | F407F27C1829B3F000A2753E /* MenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MenuViewController.h; path = Classes/MenuViewController.h; sourceTree = ""; }; 61 | F407F27D1829B3F000A2753E /* MenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MenuViewController.m; path = Classes/MenuViewController.m; sourceTree = ""; }; 62 | F407F27F1829B46100A2753E /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RootViewController.h; path = Classes/RootViewController.h; sourceTree = ""; }; 63 | F407F2801829B46100A2753E /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RootViewController.m; path = Classes/RootViewController.m; sourceTree = ""; }; 64 | F407F2821829B66200A2753E /* TopViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TopViewController.h; path = Classes/TopViewController.h; sourceTree = ""; }; 65 | F407F2831829B66200A2753E /* TopViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TopViewController.m; path = Classes/TopViewController.m; sourceTree = ""; }; 66 | F4CCDB881829DA0400972C71 /* RightMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RightMenuViewController.h; path = Classes/RightMenuViewController.h; sourceTree = ""; }; 67 | F4CCDB891829DA0400972C71 /* RightMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RightMenuViewController.m; path = Classes/RightMenuViewController.m; sourceTree = ""; }; 68 | /* End PBXFileReference section */ 69 | 70 | /* Begin PBXFrameworksBuildPhase section */ 71 | F407F2401828EF7A00A2753E /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | F407F2491828EF7A00A2753E /* CoreGraphics.framework in Frameworks */, 76 | F407F24B1828EF7A00A2753E /* UIKit.framework in Frameworks */, 77 | F407F2471828EF7A00A2753E /* Foundation.framework in Frameworks */, 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | F407F25B1828EF7A00A2753E /* Frameworks */ = { 82 | isa = PBXFrameworksBuildPhase; 83 | buildActionMask = 2147483647; 84 | files = ( 85 | F407F2601828EF7A00A2753E /* XCTest.framework in Frameworks */, 86 | F407F2621828EF7A00A2753E /* UIKit.framework in Frameworks */, 87 | F407F2611828EF7A00A2753E /* Foundation.framework in Frameworks */, 88 | ); 89 | runOnlyForDeploymentPostprocessing = 0; 90 | }; 91 | /* End PBXFrameworksBuildPhase section */ 92 | 93 | /* Begin PBXGroup section */ 94 | F407F23A1828EF7A00A2753E = { 95 | isa = PBXGroup; 96 | children = ( 97 | F407F24C1828EF7A00A2753E /* SCSlidingViewControllerDemo */, 98 | F407F2651828EF7A00A2753E /* SCSlidingViewControllerDemoTests */, 99 | F407F2451828EF7A00A2753E /* Frameworks */, 100 | F407F2441828EF7A00A2753E /* Products */, 101 | ); 102 | sourceTree = ""; 103 | }; 104 | F407F2441828EF7A00A2753E /* Products */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | F407F2431828EF7A00A2753E /* SCSlidingViewControllerDemo.app */, 108 | F407F25E1828EF7A00A2753E /* SCSlidingViewControllerDemoTests.xctest */, 109 | ); 110 | name = Products; 111 | sourceTree = ""; 112 | }; 113 | F407F2451828EF7A00A2753E /* Frameworks */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | F407F2461828EF7A00A2753E /* Foundation.framework */, 117 | F407F2481828EF7A00A2753E /* CoreGraphics.framework */, 118 | F407F24A1828EF7A00A2753E /* UIKit.framework */, 119 | F407F25F1828EF7A00A2753E /* XCTest.framework */, 120 | ); 121 | name = Frameworks; 122 | sourceTree = ""; 123 | }; 124 | F407F24C1828EF7A00A2753E /* SCSlidingViewControllerDemo */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | F407F27B1829B3D300A2753E /* Classes */, 128 | F407F2771829B2A400A2753E /* SCSlidingViewController */, 129 | F407F2551828EF7A00A2753E /* AppDelegate.h */, 130 | F407F2561828EF7A00A2753E /* AppDelegate.m */, 131 | F407F2581828EF7A00A2753E /* Images.xcassets */, 132 | F407F24D1828EF7A00A2753E /* Supporting Files */, 133 | F407F2751828F04500A2753E /* Storyboard.storyboard */, 134 | ); 135 | path = SCSlidingViewControllerDemo; 136 | sourceTree = ""; 137 | }; 138 | F407F24D1828EF7A00A2753E /* Supporting Files */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | F407F24E1828EF7A00A2753E /* SCSlidingViewControllerDemo-Info.plist */, 142 | F407F24F1828EF7A00A2753E /* InfoPlist.strings */, 143 | F407F2521828EF7A00A2753E /* main.m */, 144 | F407F2541828EF7A00A2753E /* SCSlidingViewControllerDemo-Prefix.pch */, 145 | ); 146 | name = "Supporting Files"; 147 | sourceTree = ""; 148 | }; 149 | F407F2651828EF7A00A2753E /* SCSlidingViewControllerDemoTests */ = { 150 | isa = PBXGroup; 151 | children = ( 152 | F407F26B1828EF7A00A2753E /* SCSlidingViewControllerDemoTests.m */, 153 | F407F2661828EF7A00A2753E /* Supporting Files */, 154 | ); 155 | path = SCSlidingViewControllerDemoTests; 156 | sourceTree = ""; 157 | }; 158 | F407F2661828EF7A00A2753E /* Supporting Files */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | F407F2671828EF7A00A2753E /* SCSlidingViewControllerDemoTests-Info.plist */, 162 | F407F2681828EF7A00A2753E /* InfoPlist.strings */, 163 | ); 164 | name = "Supporting Files"; 165 | sourceTree = ""; 166 | }; 167 | F407F2771829B2A400A2753E /* SCSlidingViewController */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | F407F2781829B2A400A2753E /* SCSlidingViewController.h */, 171 | F407F2791829B2A400A2753E /* SCSlidingViewController.m */, 172 | ); 173 | path = SCSlidingViewController; 174 | sourceTree = ""; 175 | }; 176 | F407F27B1829B3D300A2753E /* Classes */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | F407F27F1829B46100A2753E /* RootViewController.h */, 180 | F407F2801829B46100A2753E /* RootViewController.m */, 181 | F407F27C1829B3F000A2753E /* MenuViewController.h */, 182 | F407F27D1829B3F000A2753E /* MenuViewController.m */, 183 | F4CCDB881829DA0400972C71 /* RightMenuViewController.h */, 184 | F4CCDB891829DA0400972C71 /* RightMenuViewController.m */, 185 | F407F2821829B66200A2753E /* TopViewController.h */, 186 | F407F2831829B66200A2753E /* TopViewController.m */, 187 | ); 188 | name = Classes; 189 | sourceTree = ""; 190 | }; 191 | /* End PBXGroup section */ 192 | 193 | /* Begin PBXNativeTarget section */ 194 | F407F2421828EF7A00A2753E /* SCSlidingViewControllerDemo */ = { 195 | isa = PBXNativeTarget; 196 | buildConfigurationList = F407F26F1828EF7A00A2753E /* Build configuration list for PBXNativeTarget "SCSlidingViewControllerDemo" */; 197 | buildPhases = ( 198 | F407F23F1828EF7A00A2753E /* Sources */, 199 | F407F2401828EF7A00A2753E /* Frameworks */, 200 | F407F2411828EF7A00A2753E /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | ); 206 | name = SCSlidingViewControllerDemo; 207 | productName = SCSlidingViewControllerDemo; 208 | productReference = F407F2431828EF7A00A2753E /* SCSlidingViewControllerDemo.app */; 209 | productType = "com.apple.product-type.application"; 210 | }; 211 | F407F25D1828EF7A00A2753E /* SCSlidingViewControllerDemoTests */ = { 212 | isa = PBXNativeTarget; 213 | buildConfigurationList = F407F2721828EF7A00A2753E /* Build configuration list for PBXNativeTarget "SCSlidingViewControllerDemoTests" */; 214 | buildPhases = ( 215 | F407F25A1828EF7A00A2753E /* Sources */, 216 | F407F25B1828EF7A00A2753E /* Frameworks */, 217 | F407F25C1828EF7A00A2753E /* Resources */, 218 | ); 219 | buildRules = ( 220 | ); 221 | dependencies = ( 222 | F407F2641828EF7A00A2753E /* PBXTargetDependency */, 223 | ); 224 | name = SCSlidingViewControllerDemoTests; 225 | productName = SCSlidingViewControllerDemoTests; 226 | productReference = F407F25E1828EF7A00A2753E /* SCSlidingViewControllerDemoTests.xctest */; 227 | productType = "com.apple.product-type.bundle.unit-test"; 228 | }; 229 | /* End PBXNativeTarget section */ 230 | 231 | /* Begin PBXProject section */ 232 | F407F23B1828EF7A00A2753E /* Project object */ = { 233 | isa = PBXProject; 234 | attributes = { 235 | LastUpgradeCheck = 0500; 236 | ORGANIZATIONNAME = "Simon Coulton"; 237 | TargetAttributes = { 238 | F407F25D1828EF7A00A2753E = { 239 | TestTargetID = F407F2421828EF7A00A2753E; 240 | }; 241 | }; 242 | }; 243 | buildConfigurationList = F407F23E1828EF7A00A2753E /* Build configuration list for PBXProject "SCSlidingViewControllerDemo" */; 244 | compatibilityVersion = "Xcode 3.2"; 245 | developmentRegion = English; 246 | hasScannedForEncodings = 0; 247 | knownRegions = ( 248 | en, 249 | ); 250 | mainGroup = F407F23A1828EF7A00A2753E; 251 | productRefGroup = F407F2441828EF7A00A2753E /* Products */; 252 | projectDirPath = ""; 253 | projectRoot = ""; 254 | targets = ( 255 | F407F2421828EF7A00A2753E /* SCSlidingViewControllerDemo */, 256 | F407F25D1828EF7A00A2753E /* SCSlidingViewControllerDemoTests */, 257 | ); 258 | }; 259 | /* End PBXProject section */ 260 | 261 | /* Begin PBXResourcesBuildPhase section */ 262 | F407F2411828EF7A00A2753E /* Resources */ = { 263 | isa = PBXResourcesBuildPhase; 264 | buildActionMask = 2147483647; 265 | files = ( 266 | F407F2511828EF7A00A2753E /* InfoPlist.strings in Resources */, 267 | F407F2591828EF7A00A2753E /* Images.xcassets in Resources */, 268 | F407F2761828F04500A2753E /* Storyboard.storyboard in Resources */, 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | F407F25C1828EF7A00A2753E /* Resources */ = { 273 | isa = PBXResourcesBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | F407F26A1828EF7A00A2753E /* InfoPlist.strings in Resources */, 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | /* End PBXResourcesBuildPhase section */ 281 | 282 | /* Begin PBXSourcesBuildPhase section */ 283 | F407F23F1828EF7A00A2753E /* Sources */ = { 284 | isa = PBXSourcesBuildPhase; 285 | buildActionMask = 2147483647; 286 | files = ( 287 | F407F27A1829B2A400A2753E /* SCSlidingViewController.m in Sources */, 288 | F407F2571828EF7A00A2753E /* AppDelegate.m in Sources */, 289 | F407F2841829B66200A2753E /* TopViewController.m in Sources */, 290 | F407F2531828EF7A00A2753E /* main.m in Sources */, 291 | F407F27E1829B3F000A2753E /* MenuViewController.m in Sources */, 292 | F407F2811829B46100A2753E /* RootViewController.m in Sources */, 293 | F4CCDB8A1829DA0400972C71 /* RightMenuViewController.m in Sources */, 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | }; 297 | F407F25A1828EF7A00A2753E /* Sources */ = { 298 | isa = PBXSourcesBuildPhase; 299 | buildActionMask = 2147483647; 300 | files = ( 301 | F407F26C1828EF7A00A2753E /* SCSlidingViewControllerDemoTests.m in Sources */, 302 | ); 303 | runOnlyForDeploymentPostprocessing = 0; 304 | }; 305 | /* End PBXSourcesBuildPhase section */ 306 | 307 | /* Begin PBXTargetDependency section */ 308 | F407F2641828EF7A00A2753E /* PBXTargetDependency */ = { 309 | isa = PBXTargetDependency; 310 | target = F407F2421828EF7A00A2753E /* SCSlidingViewControllerDemo */; 311 | targetProxy = F407F2631828EF7A00A2753E /* PBXContainerItemProxy */; 312 | }; 313 | /* End PBXTargetDependency section */ 314 | 315 | /* Begin PBXVariantGroup section */ 316 | F407F24F1828EF7A00A2753E /* InfoPlist.strings */ = { 317 | isa = PBXVariantGroup; 318 | children = ( 319 | F407F2501828EF7A00A2753E /* en */, 320 | ); 321 | name = InfoPlist.strings; 322 | sourceTree = ""; 323 | }; 324 | F407F2681828EF7A00A2753E /* InfoPlist.strings */ = { 325 | isa = PBXVariantGroup; 326 | children = ( 327 | F407F2691828EF7A00A2753E /* en */, 328 | ); 329 | name = InfoPlist.strings; 330 | sourceTree = ""; 331 | }; 332 | /* End PBXVariantGroup section */ 333 | 334 | /* Begin XCBuildConfiguration section */ 335 | F407F26D1828EF7A00A2753E /* Debug */ = { 336 | isa = XCBuildConfiguration; 337 | buildSettings = { 338 | ALWAYS_SEARCH_USER_PATHS = NO; 339 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 340 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 341 | CLANG_CXX_LIBRARY = "libc++"; 342 | CLANG_ENABLE_MODULES = YES; 343 | CLANG_ENABLE_OBJC_ARC = YES; 344 | CLANG_WARN_BOOL_CONVERSION = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INT_CONVERSION = YES; 350 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 351 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 352 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 353 | COPY_PHASE_STRIP = NO; 354 | GCC_C_LANGUAGE_STANDARD = gnu99; 355 | GCC_DYNAMIC_NO_PIC = NO; 356 | GCC_OPTIMIZATION_LEVEL = 0; 357 | GCC_PREPROCESSOR_DEFINITIONS = ( 358 | "DEBUG=1", 359 | "$(inherited)", 360 | ); 361 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 362 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 363 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 364 | GCC_WARN_UNDECLARED_SELECTOR = YES; 365 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 366 | GCC_WARN_UNUSED_FUNCTION = YES; 367 | GCC_WARN_UNUSED_VARIABLE = YES; 368 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 369 | ONLY_ACTIVE_ARCH = YES; 370 | SDKROOT = iphoneos; 371 | TARGETED_DEVICE_FAMILY = "1,2"; 372 | }; 373 | name = Debug; 374 | }; 375 | F407F26E1828EF7A00A2753E /* Release */ = { 376 | isa = XCBuildConfiguration; 377 | buildSettings = { 378 | ALWAYS_SEARCH_USER_PATHS = NO; 379 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 380 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 381 | CLANG_CXX_LIBRARY = "libc++"; 382 | CLANG_ENABLE_MODULES = YES; 383 | CLANG_ENABLE_OBJC_ARC = YES; 384 | CLANG_WARN_BOOL_CONVERSION = YES; 385 | CLANG_WARN_CONSTANT_CONVERSION = YES; 386 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 387 | CLANG_WARN_EMPTY_BODY = YES; 388 | CLANG_WARN_ENUM_CONVERSION = YES; 389 | CLANG_WARN_INT_CONVERSION = YES; 390 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 391 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 392 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 393 | COPY_PHASE_STRIP = YES; 394 | ENABLE_NS_ASSERTIONS = NO; 395 | GCC_C_LANGUAGE_STANDARD = gnu99; 396 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 397 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 398 | GCC_WARN_UNDECLARED_SELECTOR = YES; 399 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 400 | GCC_WARN_UNUSED_FUNCTION = YES; 401 | GCC_WARN_UNUSED_VARIABLE = YES; 402 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 403 | SDKROOT = iphoneos; 404 | TARGETED_DEVICE_FAMILY = "1,2"; 405 | VALIDATE_PRODUCT = YES; 406 | }; 407 | name = Release; 408 | }; 409 | F407F2701828EF7A00A2753E /* Debug */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 413 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 414 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 415 | GCC_PREFIX_HEADER = "SCSlidingViewControllerDemo/SCSlidingViewControllerDemo-Prefix.pch"; 416 | INFOPLIST_FILE = "SCSlidingViewControllerDemo/SCSlidingViewControllerDemo-Info.plist"; 417 | PRODUCT_NAME = "$(TARGET_NAME)"; 418 | WRAPPER_EXTENSION = app; 419 | }; 420 | name = Debug; 421 | }; 422 | F407F2711828EF7A00A2753E /* Release */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 426 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 427 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 428 | GCC_PREFIX_HEADER = "SCSlidingViewControllerDemo/SCSlidingViewControllerDemo-Prefix.pch"; 429 | INFOPLIST_FILE = "SCSlidingViewControllerDemo/SCSlidingViewControllerDemo-Info.plist"; 430 | PRODUCT_NAME = "$(TARGET_NAME)"; 431 | WRAPPER_EXTENSION = app; 432 | }; 433 | name = Release; 434 | }; 435 | F407F2731828EF7A00A2753E /* Debug */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 439 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SCSlidingViewControllerDemo.app/SCSlidingViewControllerDemo"; 440 | FRAMEWORK_SEARCH_PATHS = ( 441 | "$(SDKROOT)/Developer/Library/Frameworks", 442 | "$(inherited)", 443 | "$(DEVELOPER_FRAMEWORKS_DIR)", 444 | ); 445 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 446 | GCC_PREFIX_HEADER = "SCSlidingViewControllerDemo/SCSlidingViewControllerDemo-Prefix.pch"; 447 | GCC_PREPROCESSOR_DEFINITIONS = ( 448 | "DEBUG=1", 449 | "$(inherited)", 450 | ); 451 | INFOPLIST_FILE = "SCSlidingViewControllerDemoTests/SCSlidingViewControllerDemoTests-Info.plist"; 452 | PRODUCT_NAME = "$(TARGET_NAME)"; 453 | TEST_HOST = "$(BUNDLE_LOADER)"; 454 | WRAPPER_EXTENSION = xctest; 455 | }; 456 | name = Debug; 457 | }; 458 | F407F2741828EF7A00A2753E /* Release */ = { 459 | isa = XCBuildConfiguration; 460 | buildSettings = { 461 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 462 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SCSlidingViewControllerDemo.app/SCSlidingViewControllerDemo"; 463 | FRAMEWORK_SEARCH_PATHS = ( 464 | "$(SDKROOT)/Developer/Library/Frameworks", 465 | "$(inherited)", 466 | "$(DEVELOPER_FRAMEWORKS_DIR)", 467 | ); 468 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 469 | GCC_PREFIX_HEADER = "SCSlidingViewControllerDemo/SCSlidingViewControllerDemo-Prefix.pch"; 470 | INFOPLIST_FILE = "SCSlidingViewControllerDemoTests/SCSlidingViewControllerDemoTests-Info.plist"; 471 | PRODUCT_NAME = "$(TARGET_NAME)"; 472 | TEST_HOST = "$(BUNDLE_LOADER)"; 473 | WRAPPER_EXTENSION = xctest; 474 | }; 475 | name = Release; 476 | }; 477 | /* End XCBuildConfiguration section */ 478 | 479 | /* Begin XCConfigurationList section */ 480 | F407F23E1828EF7A00A2753E /* Build configuration list for PBXProject "SCSlidingViewControllerDemo" */ = { 481 | isa = XCConfigurationList; 482 | buildConfigurations = ( 483 | F407F26D1828EF7A00A2753E /* Debug */, 484 | F407F26E1828EF7A00A2753E /* Release */, 485 | ); 486 | defaultConfigurationIsVisible = 0; 487 | defaultConfigurationName = Release; 488 | }; 489 | F407F26F1828EF7A00A2753E /* Build configuration list for PBXNativeTarget "SCSlidingViewControllerDemo" */ = { 490 | isa = XCConfigurationList; 491 | buildConfigurations = ( 492 | F407F2701828EF7A00A2753E /* Debug */, 493 | F407F2711828EF7A00A2753E /* Release */, 494 | ); 495 | defaultConfigurationIsVisible = 0; 496 | defaultConfigurationName = Release; 497 | }; 498 | F407F2721828EF7A00A2753E /* Build configuration list for PBXNativeTarget "SCSlidingViewControllerDemoTests" */ = { 499 | isa = XCConfigurationList; 500 | buildConfigurations = ( 501 | F407F2731828EF7A00A2753E /* Debug */, 502 | F407F2741828EF7A00A2753E /* Release */, 503 | ); 504 | defaultConfigurationIsVisible = 0; 505 | defaultConfigurationName = Release; 506 | }; 507 | /* End XCConfigurationList section */ 508 | }; 509 | rootObject = F407F23B1828EF7A00A2753E /* Project object */; 510 | } 511 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo.xcodeproj/project.xcworkspace/xcshareddata/SCSlidingViewControllerDemo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | F681D0E7-B87A-477D-B544-123E26675DB6 9 | IDESourceControlProjectName 10 | SCSlidingViewControllerDemo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 41F0333E-66E0-4501-9114-563E534C3586 14 | ssh://github.com/simoncoulton/SCSlidingViewController.git 15 | 16 | IDESourceControlProjectPath 17 | SCSlidingViewControllerDemo/SCSlidingViewControllerDemo.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 41F0333E-66E0-4501-9114-563E534C3586 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://github.com/simoncoulton/SCSlidingViewController.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | 41F0333E-66E0-4501-9114-563E534C3586 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 41F0333E-66E0-4501-9114-563E534C3586 36 | IDESourceControlWCCName 37 | SCSlidingViewController 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo.xcodeproj/project.xcworkspace/xcuserdata/simon.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simoncoulton/SCSlidingViewController/e400b9a16024d2a486a806b5c510a7dff74e1271/SCSlidingViewController/SCSlidingViewControllerDemo.xcodeproj/project.xcworkspace/xcuserdata/simon.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo.xcodeproj/xcuserdata/simon.xcuserdatad/xcschemes/SCSlidingViewControllerDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo.xcodeproj/xcuserdata/simon.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SCSlidingViewControllerDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | F407F2421828EF7A00A2753E 16 | 17 | primary 18 | 19 | 20 | F407F25D1828EF7A00A2753E 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SCSlidingViewControllerDemo 4 | // 5 | // Created by Simon Coulton on 5/11/2013. 6 | // Copyright (c) 2013 Simon Coulton. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SCSlidingViewControllerDemo 4 | // 5 | // Created by Simon Coulton on 5/11/2013. 6 | // Copyright (c) 2013 Simon Coulton. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 16 | 17 | // Initialize the storyboard 18 | UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil]; 19 | // Set the rootViewController 20 | self.window.rootViewController = [storyboard instantiateInitialViewController]; 21 | // Customise the statusbar text color 22 | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 23 | 24 | self.window.backgroundColor = [UIColor whiteColor]; 25 | [self.window makeKeyAndVisible]; 26 | return YES; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/Classes/MenuViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MenuViewController.h 3 | // SCSlidingViewControllerDemo 4 | // 5 | // Created by Simon Coulton on 6/11/2013. 6 | // Copyright (c) 2013 Simon Coulton. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SCSlidingViewController.h" 11 | 12 | @interface MenuViewController : UIViewController 13 | 14 | - (IBAction)showViewControllerButtonClicked:(id)sender; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/Classes/MenuViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MenuViewController.m 3 | // SCSlidingViewControllerDemo 4 | // 5 | // Created by Simon Coulton on 6/11/2013. 6 | // Copyright (c) 2013 Simon Coulton. All rights reserved. 7 | // 8 | 9 | #import "MenuViewController.h" 10 | 11 | @implementation MenuViewController 12 | 13 | - (IBAction)showViewControllerButtonClicked:(id)sender 14 | { 15 | NSString *viewControllerName = ((UIButton *)sender).titleLabel.text; 16 | [self.slidingViewController changeTopViewController:[self.storyboard instantiateViewControllerWithIdentifier:viewControllerName]]; 17 | } 18 | 19 | - (UIStatusBarStyle)preferredStatusBarStyle 20 | { 21 | return UIStatusBarStyleDefault; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/Classes/RightMenuViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RightMenuViewController.h 3 | // SCSlidingViewControllerDemo 4 | // 5 | // Created by Simon Coulton on 6/11/2013. 6 | // Copyright (c) 2013 Simon Coulton. All rights reserved. 7 | // 8 | 9 | #import "MenuViewController.h" 10 | 11 | @interface RightMenuViewController : MenuViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/Classes/RightMenuViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RightMenuViewController.m 3 | // SCSlidingViewControllerDemo 4 | // 5 | // Created by Simon Coulton on 6/11/2013. 6 | // Copyright (c) 2013 Simon Coulton. All rights reserved. 7 | // 8 | 9 | #import "RightMenuViewController.h" 10 | 11 | @implementation RightMenuViewController 12 | 13 | - (UIStatusBarStyle)preferredStatusBarStyle 14 | { 15 | return UIStatusBarStyleLightContent; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/Classes/RootViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.h 3 | // SCSlidingViewControllerDemo 4 | // 5 | // Created by Simon Coulton on 6/11/2013. 6 | // Copyright (c) 2013 Simon Coulton. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SCSlidingViewController.h" 11 | 12 | @interface RootViewController : SCSlidingViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/Classes/RootViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.m 3 | // SCSlidingViewControllerDemo 4 | // 5 | // Created by Simon Coulton on 6/11/2013. 6 | // Copyright (c) 2013 Simon Coulton. All rights reserved. 7 | // 8 | 9 | #import "RootViewController.h" 10 | 11 | @implementation RootViewController 12 | 13 | - (void)viewDidLoad 14 | { 15 | [super viewDidLoad]; 16 | self.peakAmount = 250; 17 | self.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"TopViewController"]; 18 | self.leftSideViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"LeftViewController"]; 19 | self.rightSideViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"RightViewController"]; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/Classes/TopViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TopViewController.h 3 | // SCSlidingViewControllerDemo 4 | // 5 | // Created by Simon Coulton on 6/11/2013. 6 | // Copyright (c) 2013 Simon Coulton. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SCSlidingViewController.h" 11 | 12 | @interface TopViewController : UIViewController 13 | 14 | @property (nonatomic, strong) IBOutlet UISlider *peakThresholdValue; 15 | @property (nonatomic, strong) IBOutlet UISlider *peakAmountValue; 16 | @property (nonatomic, strong) IBOutlet UISwitch *allowOverswipeValue; 17 | 18 | - (IBAction)toggleLeftButtonClicked:(id)sender; 19 | - (IBAction)toggleRightButtonClicked:(id)sender; 20 | - (IBAction)peakAmountSliderChanged:(UISlider *)sender; 21 | - (IBAction)peakThresholdSliderChanged:(UISlider *)sender; 22 | - (IBAction)allowOverswipeToggleChanged:(UISwitch *)sender; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/Classes/TopViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TopViewController.m 3 | // SCSlidingViewControllerDemo 4 | // 5 | // Created by Simon Coulton on 6/11/2013. 6 | // Copyright (c) 2013 Simon Coulton. All rights reserved. 7 | // 8 | 9 | #import "TopViewController.h" 10 | 11 | @implementation TopViewController 12 | 13 | - (IBAction)toggleLeftButtonClicked:(id)sender 14 | { 15 | [self.slidingViewController slideRight]; 16 | } 17 | 18 | - (IBAction)toggleRightButtonClicked:(id)sender 19 | { 20 | [self.slidingViewController slideLeft]; 21 | } 22 | 23 | - (IBAction)peakAmountSliderChanged:(UISlider *)sender 24 | { 25 | int intValue = roundl(sender.value); 26 | sender.value = intValue; 27 | self.slidingViewController.peakAmount = intValue; 28 | } 29 | 30 | - (IBAction)peakThresholdSliderChanged:(UISlider *)sender 31 | { 32 | self.slidingViewController.peakThreshold = sender.value; 33 | } 34 | 35 | - (IBAction)allowOverswipeToggleChanged:(UISwitch *)sender 36 | { 37 | self.slidingViewController.allowOverswipe = sender.isOn; 38 | } 39 | 40 | - (void)viewDidLoad 41 | { 42 | [super viewDidLoad]; 43 | self.peakAmountValue.continuous = NO; 44 | self.peakThresholdValue.continuous = NO; 45 | } 46 | 47 | - (void)viewDidAppear:(BOOL)animated 48 | { 49 | self.peakAmountValue.value = self.slidingViewController.peakAmount; 50 | self.peakThresholdValue.value = self.slidingViewController.peakThreshold; 51 | self.allowOverswipeValue.on = self.slidingViewController.allowOverswipe; 52 | [super viewDidAppear:animated]; 53 | } 54 | 55 | - (UIStatusBarStyle)preferredStatusBarStyle 56 | { 57 | return UIStatusBarStyleLightContent; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/SCSlidingViewController/SCSlidingViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SCSlidingViewController.h 3 | // 4 | // Created by Simon Coulton on 11/10/13. 5 | // Copyright (c) 2013 Simon Coulton. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @protocol SCSlidingViewControllerDelegate 11 | 12 | @end 13 | 14 | @interface SCSlidingViewController : UIViewController 15 | 16 | #pragma mark View Controllers 17 | @property (strong, nonatomic) UIViewController *topViewController; 18 | @property (strong, nonatomic) UIViewController *leftSideViewController; 19 | @property (strong, nonatomic) UIViewController *rightSideViewController; 20 | 21 | #pragma mark Settings 22 | @property (nonatomic) BOOL allowOverswipe; 23 | @property (nonatomic) BOOL animateOnClose; 24 | @property (nonatomic) int topViewOffsetY; 25 | @property (nonatomic) int peakAmount; 26 | @property (nonatomic) CGFloat peakThreshold; 27 | @property (nonatomic) CGFloat cornerRadius; 28 | @property (nonatomic) CGFloat shadowOpacity; 29 | @property (nonatomic) CGFloat shadowOffsetX; 30 | @property (nonatomic) CGFloat shadowOffsetY; 31 | @property (retain, nonatomic) UIColor *shadowColor; 32 | @property (nonatomic) CGFloat animationDuration; 33 | @property (nonatomic) BOOL enabled; 34 | 35 | #pragma mark Visibility 36 | @property (assign, nonatomic) BOOL showingLeft; 37 | @property (assign, nonatomic) BOOL showingRight; 38 | 39 | #pragma mark Gestures 40 | @property (strong, nonatomic) UIGestureRecognizer *panGesture; 41 | @property (strong, nonatomic) UIGestureRecognizer *tapGesture; 42 | 43 | #pragma mark Animations 44 | - (void)slideRight; 45 | - (void)slideLeft; 46 | - (void)snapToOrigin; 47 | 48 | #pragma mark Change view 49 | - (void)changeTopViewController:(UIViewController *)viewController; 50 | - (void)changeTopViewController:(UIViewController *)viewController forceReload:(BOOL)forceReload; 51 | - (void)changeTopViewControllerFromStoryboard:(NSString *)identifier; 52 | - (void)changeTopViewControllerFromStoryboard:(NSString *)identifier forceReload:(BOOL)forceReload; 53 | 54 | #pragma mark Change view events 55 | - (void)willChangeTopViewController; 56 | - (void)didChangeTopViewController; 57 | 58 | #pragma mark Slide events 59 | - (void)didFinishSliding; 60 | 61 | #pragma mark Shadow 62 | - (void)viewHasShadow:(BOOL)hasShadow withColor:(UIColor *)color withCornerRadius:(CGFloat)cornerRadius withShadowOffsetX:(CGFloat)shadowOffsetX withShadowOffsetY:(CGFloat)shadowOffsetY andOpacity:(CGFloat)opacity; 63 | 64 | @end 65 | 66 | 67 | @interface UIViewController(SlidingViewCategory) 68 | 69 | - (SCSlidingViewController *)slidingViewController; 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/SCSlidingViewController/SCSlidingViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SCSlidingViewController.m 3 | // 4 | // Created by Simon Coulton on 11/10/13. 5 | // Copyright (c) 2013 Simon Coulton. All rights reserved. 6 | // 7 | 8 | #import "SCSlidingViewController.h" 9 | 10 | @interface SCSlidingViewController () 11 | 12 | @property (strong, nonatomic) UIView *containerView; 13 | @property (strong, nonatomic) UIView *overlayView; 14 | @property (assign, nonatomic) CGPoint previousVelocity; 15 | 16 | @end 17 | 18 | #pragma mark - 19 | #pragma mark UIViewController Category 20 | 21 | @implementation UIViewController(SlidingViewCategory) 22 | 23 | - (SCSlidingViewController *)slidingViewController 24 | { 25 | UIViewController *viewController = self.parentViewController; 26 | while (!(viewController == nil || [viewController isKindOfClass:[SCSlidingViewController class]])) { 27 | viewController = viewController.parentViewController; 28 | } 29 | 30 | return (SCSlidingViewController *)viewController; 31 | } 32 | 33 | @end 34 | 35 | #pragma mark - 36 | #pragma mark Initialization 37 | 38 | @implementation SCSlidingViewController 39 | 40 | - (void)viewDidLoad 41 | { 42 | [super viewDidLoad]; 43 | [self setDefaults]; 44 | } 45 | 46 | - (void)setDefaults 47 | { 48 | if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) { 49 | // iOS 7, offset it below the status bar 50 | self.topViewOffsetY = 20; 51 | } else { 52 | self.topViewOffsetY = 0; 53 | } 54 | self.allowOverswipe = NO; 55 | self.animateOnClose = NO; 56 | self.peakAmount = 140; 57 | self.peakThreshold = .5; 58 | self.shadowColor = [UIColor blackColor]; 59 | self.shadowOpacity = 0.5f; 60 | self.shadowOffsetX = self.shadowOffsetY = 3.0f; 61 | self.cornerRadius = 4.0f; 62 | self.animationDuration = 0.5f; 63 | self.enabled = YES; 64 | } 65 | 66 | #pragma mark - 67 | #pragma mark Set the views 68 | 69 | - (UIView *)containerView 70 | { 71 | // The view that the top view controller will be added to 72 | if (_containerView) { 73 | return _containerView; 74 | } 75 | 76 | UIView *view = [[UIView alloc] initWithFrame:CGRectOffset(self.view.frame, 0, 0)]; 77 | _containerView = view; 78 | view.backgroundColor = [UIColor clearColor]; 79 | view.frame = CGRectMake(0, self.topViewOffsetY, view.frame.size.width, view.frame.size.height - self.topViewOffsetY); 80 | [self.view addSubview:_containerView]; 81 | 82 | return view; 83 | } 84 | 85 | - (UIView *)overlayView 86 | { 87 | // Sits ontop of the top view controller while the view controller is panning 88 | // and prevents other ui elements from triggering gestures 89 | if (_overlayView) { 90 | return _overlayView; 91 | } 92 | 93 | UIView *view = [[UIView alloc] initWithFrame:CGRectOffset(self.view.frame, 0, 0)]; 94 | _overlayView = view; 95 | view.backgroundColor = [UIColor clearColor]; 96 | view.frame = CGRectMake(0, 0, view.frame.size.width, view.frame.size.height - self.topViewOffsetY); 97 | [self.containerView addSubview:_overlayView]; 98 | [self.containerView sendSubviewToBack:_overlayView]; 99 | 100 | return view; 101 | } 102 | 103 | - (void)setTopViewController:(UIViewController *)topViewController 104 | { 105 | CGRect frame = self.containerView.frame; 106 | [topViewController.view removeFromSuperview]; 107 | [topViewController willMoveToParentViewController:nil]; 108 | [topViewController removeFromParentViewController]; 109 | 110 | self->_topViewController = topViewController; 111 | [self.containerView addSubview:topViewController.view]; 112 | [self addChildViewController:topViewController]; 113 | [topViewController didMoveToParentViewController:self]; 114 | 115 | topViewController.view.frame = CGRectMake(0, 0, frame.size.width, frame.size.height); 116 | [self viewHasShadow:(self.shadowOpacity == 0 ? NO : YES) withColor:self.shadowColor withCornerRadius:self.cornerRadius withShadowOffsetX:self.shadowOffsetX withShadowOffsetY:self.shadowOffsetY andOpacity:self.shadowOpacity]; 117 | [self addGestures]; 118 | [self.view endEditing:YES]; 119 | } 120 | 121 | - (void)viewHasShadow:(BOOL)hasShadow withColor:(UIColor *)color withCornerRadius:(CGFloat)cornerRadius withShadowOffsetX:(CGFloat)shadowOffsetX withShadowOffsetY:(CGFloat)shadowOffsetY andOpacity:(CGFloat)opacity 122 | { 123 | self.topViewController.view.layer.opaque = NO; 124 | self.topViewController.view.layer.cornerRadius = cornerRadius; 125 | 126 | if (hasShadow) { 127 | self.containerView.layer.shouldRasterize = YES; 128 | self.containerView.layer.rasterizationScale = [[UIScreen mainScreen] scale]; 129 | self.containerView.layer.shadowOpacity = opacity; 130 | self.containerView.layer.shadowOffset = CGSizeMake(shadowOffsetX, shadowOffsetY); 131 | self.containerView.layer.shadowColor = color.CGColor; 132 | self.containerView.layer.shadowRadius = cornerRadius; 133 | self.containerView.alpha = 1; 134 | } else { 135 | self.containerView.alpha = 0; 136 | } 137 | } 138 | 139 | - (void)setLeftSideViewController:(UIViewController *)leftSideViewController 140 | { 141 | [leftSideViewController.view removeFromSuperview]; 142 | [leftSideViewController willMoveToParentViewController:nil]; 143 | [leftSideViewController removeFromParentViewController]; 144 | 145 | self->_leftSideViewController = leftSideViewController; 146 | [self.view addSubview:leftSideViewController.view]; 147 | [self.view sendSubviewToBack:leftSideViewController.view]; 148 | [self addChildViewController:leftSideViewController]; 149 | [leftSideViewController didMoveToParentViewController:self]; 150 | } 151 | 152 | - (void)setRightSideViewController:(UIViewController *)rightSideViewController 153 | { 154 | [rightSideViewController.view removeFromSuperview]; 155 | [rightSideViewController willMoveToParentViewController:nil]; 156 | [rightSideViewController removeFromParentViewController]; 157 | 158 | self->_rightSideViewController = rightSideViewController; 159 | [self.view addSubview:rightSideViewController.view]; 160 | [self.view sendSubviewToBack:rightSideViewController.view]; 161 | [self addChildViewController:rightSideViewController]; 162 | [rightSideViewController didMoveToParentViewController:self]; 163 | } 164 | 165 | #pragma mark - 166 | #pragma mark Animate to position 167 | 168 | - (void)slideRight 169 | { 170 | // Display the leftSide view controller 171 | if (self.rightSideViewController) { 172 | [self.view sendSubviewToBack:self.rightSideViewController.view]; 173 | if ([self.rightSideViewController respondsToSelector:@selector(preferredStatusBarStyle)]) { 174 | [[UIApplication sharedApplication] setStatusBarStyle:[self.rightSideViewController preferredStatusBarStyle]]; 175 | } 176 | } 177 | if (!self.leftSideViewController) { 178 | return; 179 | } 180 | [self.view bringSubviewToFront:self.containerView]; 181 | if (self.showingLeft && self.containerView.frame.origin.x == self.peakAmount) { 182 | [self snapToOrigin]; 183 | } else { 184 | CGFloat xPos = self.peakAmount; 185 | [UIView animateWithDuration:self.animationDuration delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ 186 | self.containerView.frame = CGRectMake(xPos, self.topViewOffsetY, self.view.frame.size.width, self.view.frame.size.height - self.topViewOffsetY); 187 | } completion:^(BOOL finished) { 188 | self.showingLeft = YES; 189 | [self switchGestureTargetFromView:self.topViewController.view toView:self.overlayView]; 190 | [self didFinishSliding]; 191 | }]; 192 | } 193 | } 194 | 195 | - (void)slideLeft 196 | { 197 | // Display the rightSide view controller 198 | if (self.leftSideViewController) { 199 | [self.view sendSubviewToBack:self.leftSideViewController.view]; 200 | if ([self.leftSideViewController respondsToSelector:@selector(preferredStatusBarStyle)]) { 201 | [[UIApplication sharedApplication] setStatusBarStyle:[self.leftSideViewController preferredStatusBarStyle]]; 202 | } 203 | } 204 | if (!self.rightSideViewController) { 205 | return; 206 | } 207 | [self.view bringSubviewToFront:self.containerView]; 208 | if (self.showingRight && self.containerView.frame.origin.x == 0 - self.peakAmount) { 209 | [self snapToOrigin]; 210 | } else { 211 | CGFloat xPos = 0 - self.peakAmount; 212 | [UIView animateWithDuration:self.animationDuration delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ 213 | self.containerView.frame = CGRectMake(xPos, self.topViewOffsetY, self.view.frame.size.width, self.view.frame.size.height - self.topViewOffsetY); 214 | } completion:^(BOOL finished) { 215 | self.showingRight = YES; 216 | [self switchGestureTargetFromView:self.topViewController.view toView:self.overlayView]; 217 | [self didFinishSliding]; 218 | }]; 219 | } 220 | } 221 | 222 | - (void)switchGestureTargetFromView:(UIView *)fromView toView:(UIView *)toView 223 | { 224 | [fromView removeGestureRecognizer:self.panGesture]; 225 | [toView removeGestureRecognizer:self.panGesture]; 226 | [fromView removeGestureRecognizer:self.tapGesture]; 227 | [toView removeGestureRecognizer:self.tapGesture]; 228 | if (toView == self.overlayView) { 229 | [toView addGestureRecognizer:self.tapGesture]; 230 | [self.containerView bringSubviewToFront:self.overlayView]; 231 | } else { 232 | [self.containerView sendSubviewToBack:self.overlayView]; 233 | } 234 | [toView addGestureRecognizer:self.panGesture]; 235 | } 236 | 237 | - (void)snapToOrigin 238 | { 239 | self.showingLeft = NO; 240 | self.showingRight = NO; 241 | [UIView animateWithDuration:self.animationDuration / 2 delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ 242 | CGRect frame = CGRectMake(0, self.topViewOffsetY, self.view.frame.size.width, self.view.frame.size.height - self.topViewOffsetY); 243 | self.containerView.frame = frame; 244 | } completion:^(BOOL finished) { 245 | [self switchGestureTargetFromView:self.overlayView toView:self.topViewController.view]; 246 | [self removeTapGestures]; 247 | [self didFinishSliding]; 248 | }]; 249 | } 250 | 251 | #pragma mark - 252 | #pragma mark UIGestureRecognizers 253 | 254 | - (void)addGestures 255 | { 256 | if (!self->_panGesture) { 257 | self.panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(dragView:)]; 258 | self.panGesture.delegate = self; 259 | } 260 | if (!self->_tapGesture) { 261 | self.tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClose:)]; 262 | } 263 | [self switchGestureTargetFromView:self.overlayView toView:self.topViewController.view]; 264 | } 265 | 266 | - (void)attachTapGesture 267 | { 268 | [self removeTapGestures]; 269 | [self.topViewController.view addGestureRecognizer:self.tapGesture]; 270 | } 271 | 272 | - (void)removeTapGestures 273 | { 274 | [self.topViewController.view removeGestureRecognizer:self.tapGesture]; 275 | } 276 | 277 | - (void)dragView:(id)sender 278 | { 279 | if (!self.enabled) { 280 | return; 281 | } 282 | [[[(UITapGestureRecognizer*)sender view] layer] removeAllAnimations]; 283 | UIView *senderView = self.containerView; 284 | CGPoint translatedPoint = [(UIPanGestureRecognizer*)sender translationInView:self.view]; 285 | CGPoint velocity = [(UIPanGestureRecognizer*)sender velocityInView:senderView]; 286 | CGFloat topLeftX = senderView.frame.origin.x; 287 | 288 | if ([(UIPanGestureRecognizer*)sender state] == UIGestureRecognizerStateBegan) { 289 | [self.topViewController.view endEditing:YES]; 290 | 291 | // Determine which view to bring to the top 292 | UIViewController *viewToShow = nil; 293 | 294 | if (velocity.x > 0) { 295 | if (!self.showingRight && self.rightSideViewController) { 296 | viewToShow = self.rightSideViewController; 297 | } else { 298 | return; 299 | } 300 | } else { 301 | if (!self.showingLeft && self.leftSideViewController) { 302 | viewToShow = self.leftSideViewController; 303 | } else { 304 | return; 305 | } 306 | 307 | } 308 | if ([viewToShow respondsToSelector:@selector(preferredStatusBarStyle)]) { 309 | [[UIApplication sharedApplication] setStatusBarStyle:[viewToShow preferredStatusBarStyle]]; 310 | } 311 | [self.view sendSubviewToBack:viewToShow.view]; 312 | [senderView bringSubviewToFront:[(UIPanGestureRecognizer*)sender view]]; 313 | } 314 | 315 | if ([(UIPanGestureRecognizer*)sender state] == UIGestureRecognizerStateEnded) { 316 | CGFloat frameWidth = senderView.frame.size.width; 317 | CGFloat widthVisibleAfterPeak = frameWidth - self.peakAmount; 318 | CGFloat thresholdCenter = (frameWidth - widthVisibleAfterPeak) * self.peakThreshold; 319 | if (self.showingLeft) { 320 | if (topLeftX < thresholdCenter) { 321 | [self snapToOrigin]; 322 | } else { 323 | [self slideRight]; 324 | } 325 | } else if (self.showingRight) { 326 | if (topLeftX < 0 - thresholdCenter) { 327 | [self slideLeft]; 328 | } else { 329 | [self snapToOrigin]; 330 | } 331 | } else { 332 | [self snapToOrigin]; 333 | } 334 | } 335 | 336 | if ([(UIPanGestureRecognizer*)sender state] == UIGestureRecognizerStateChanged) { 337 | CGFloat centerX = senderView.center.x; 338 | CGFloat centerY = senderView.center.y; 339 | CGPoint newCenter = CGPointMake(centerX + translatedPoint.x, centerY); 340 | CGFloat frameCenter = senderView.frame.size.width / 2; 341 | 342 | // Sliding to the left 343 | if ((velocity.x < 0 && !self.rightSideViewController && newCenter.x < frameCenter) 344 | || (velocity.x > 0 && !self.leftSideViewController && newCenter.x > frameCenter) 345 | || (self.showingLeft && newCenter.x < frameCenter && !self.allowOverswipe) 346 | || (self.showingRight && newCenter.x > frameCenter && !self.allowOverswipe)) { 347 | return; 348 | } 349 | 350 | senderView.center = newCenter; 351 | // self.overlayView.center = newCenter; 352 | [(UIPanGestureRecognizer*)sender setTranslation:CGPointMake(0,0) inView:self.view]; 353 | 354 | if (newCenter.x < frameCenter) { 355 | self.showingRight = YES; 356 | self.showingLeft = NO; 357 | } else if (newCenter.x > frameCenter) { 358 | self.showingLeft = YES; 359 | self.showingRight = NO; 360 | } else { 361 | self.showingRight = NO; 362 | self.showingLeft = NO; 363 | } 364 | _previousVelocity = velocity; 365 | } 366 | } 367 | 368 | - (void)tapClose:(id)sender 369 | { 370 | [self snapToOrigin]; 371 | } 372 | 373 | #pragma mark - 374 | #pragma mark Change view controller 375 | 376 | - (void)changeTopViewControllerFromStoryboard:(NSString *)identifier 377 | { 378 | [self changeTopViewControllerFromStoryboard:identifier forceReload:NO]; 379 | } 380 | 381 | - (void)changeTopViewControllerFromStoryboard:(NSString *)identifier forceReload:(BOOL)forceReload 382 | { 383 | [self changeTopViewController:[self.storyboard instantiateViewControllerWithIdentifier:identifier] forceReload:forceReload]; 384 | } 385 | 386 | - (void)changeTopViewController:(UIViewController *)viewController 387 | { 388 | [self changeTopViewController:viewController forceReload:NO]; 389 | } 390 | 391 | - (void)changeTopViewController:(UIViewController *)viewController forceReload:(BOOL)forceReload 392 | { 393 | BOOL replaceView = YES; 394 | if (viewController.storyboard && [viewController.restorationIdentifier isEqualToString:self.topViewController.restorationIdentifier] && !forceReload) { 395 | replaceView = NO; 396 | if (!self.animateOnClose) { 397 | [self snapToOrigin]; 398 | return; 399 | } 400 | } 401 | if (replaceView) { 402 | [self willChangeTopViewController]; 403 | } 404 | 405 | CGFloat xPos = self.view.frame.size.width + 10; 406 | if (self.showingRight) { 407 | xPos = xPos * -1; 408 | } 409 | 410 | CGRect frame = CGRectMake(xPos, self.topViewOffsetY, self.view.frame.size.width, self.view.frame.size.height - self.topViewOffsetY); 411 | [UIView animateWithDuration:self.animationDuration delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ 412 | self.containerView.frame = frame; 413 | } completion:^(BOOL finished) { 414 | if (replaceView) { 415 | // Remove existing top view controller from view 416 | [self.topViewController.view removeFromSuperview]; 417 | [self.topViewController willMoveToParentViewController:nil]; 418 | [self.topViewController removeFromParentViewController]; 419 | 420 | // Replace with new view controller 421 | self.topViewController = viewController; 422 | self.topViewController.view.frame = CGRectMake(0, 0, self.containerView.frame.size.width, self.containerView.frame.size.height); 423 | [self didChangeTopViewController]; 424 | } 425 | [self snapToOrigin]; 426 | }]; 427 | } 428 | 429 | #pragma mark - 430 | #pragma mark Events 431 | - (void)didChangeTopViewController 432 | {} 433 | 434 | - (void)willChangeTopViewController 435 | {} 436 | 437 | - (void)didFinishSliding 438 | {} 439 | 440 | @end 441 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/SCSlidingViewControllerDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.bespohk.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Storyboard 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/SCSlidingViewControllerDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/Storyboard.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 75 | 86 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 125 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SCSlidingViewControllerDemo 4 | // 5 | // Created by Simon Coulton on 5/11/2013. 6 | // Copyright (c) 2013 Simon Coulton. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemoTests/SCSlidingViewControllerDemoTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.bespohk.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemoTests/SCSlidingViewControllerDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SCSlidingViewControllerDemoTests.m 3 | // SCSlidingViewControllerDemoTests 4 | // 5 | // Created by Simon Coulton on 5/11/2013. 6 | // Copyright (c) 2013 Simon Coulton. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SCSlidingViewControllerDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation SCSlidingViewControllerDemoTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /SCSlidingViewController/SCSlidingViewControllerDemoTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | --------------------------------------------------------------------------------