├── DVSlideViewController.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── dickverbunt.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── dickverbunt.xcuserdatad │ └── xcschemes │ ├── DVSlideViewController.xcscheme │ └── xcschememanagement.plist ├── DVSlideViewController ├── AppDelegate.h ├── AppDelegate.m ├── DVSlideViewController-Info.plist ├── DVSlideViewController-Prefix.pch ├── DVSlideViewController.h ├── DVSlideViewController.m ├── en.lproj │ └── InfoPlist.strings ├── grayBackground.png └── main.m ├── LICENSE.markdown ├── README.markdown └── Screenshots ├── DVSlideViewController_Screenshot1.png └── DVSlideViewController_Screenshot2.png /DVSlideViewController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | E3CC29A715AA2BDF006F1352 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E3CC29A615AA2BDF006F1352 /* UIKit.framework */; }; 11 | E3CC29A915AA2BDF006F1352 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E3CC29A815AA2BDF006F1352 /* Foundation.framework */; }; 12 | E3CC29AB15AA2BDF006F1352 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E3CC29AA15AA2BDF006F1352 /* CoreGraphics.framework */; }; 13 | E3CC29B115AA2BDF006F1352 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E3CC29AF15AA2BDF006F1352 /* InfoPlist.strings */; }; 14 | E3CC29B315AA2BDF006F1352 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E3CC29B215AA2BDF006F1352 /* main.m */; }; 15 | E3CC29B715AA2BDF006F1352 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E3CC29B615AA2BDF006F1352 /* AppDelegate.m */; }; 16 | E3CC29C815AA2E1E006F1352 /* DVSlideViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E3CC29C715AA2C38006F1352 /* DVSlideViewController.m */; }; 17 | E3CC29CE15AB7E4A006F1352 /* grayBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = E3CC29CD15AB7E4A006F1352 /* grayBackground.png */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | E3CC29A215AA2BDF006F1352 /* DVSlideViewController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DVSlideViewController.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | E3CC29A615AA2BDF006F1352 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 23 | E3CC29A815AA2BDF006F1352 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 24 | E3CC29AA15AA2BDF006F1352 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 25 | E3CC29AE15AA2BDF006F1352 /* DVSlideViewController-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DVSlideViewController-Info.plist"; sourceTree = ""; }; 26 | E3CC29B015AA2BDF006F1352 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 27 | E3CC29B215AA2BDF006F1352 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 28 | E3CC29B415AA2BDF006F1352 /* DVSlideViewController-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DVSlideViewController-Prefix.pch"; sourceTree = ""; }; 29 | E3CC29B515AA2BDF006F1352 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 30 | E3CC29B615AA2BDF006F1352 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 31 | E3CC29C615AA2C38006F1352 /* DVSlideViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DVSlideViewController.h; sourceTree = ""; }; 32 | E3CC29C715AA2C38006F1352 /* DVSlideViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DVSlideViewController.m; sourceTree = ""; }; 33 | E3CC29CD15AB7E4A006F1352 /* grayBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = grayBackground.png; sourceTree = ""; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | E3CC299F15AA2BDF006F1352 /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | E3CC29A715AA2BDF006F1352 /* UIKit.framework in Frameworks */, 42 | E3CC29A915AA2BDF006F1352 /* Foundation.framework in Frameworks */, 43 | E3CC29AB15AA2BDF006F1352 /* CoreGraphics.framework in Frameworks */, 44 | ); 45 | runOnlyForDeploymentPostprocessing = 0; 46 | }; 47 | /* End PBXFrameworksBuildPhase section */ 48 | 49 | /* Begin PBXGroup section */ 50 | E3CC299715AA2BDF006F1352 = { 51 | isa = PBXGroup; 52 | children = ( 53 | E3CC29AC15AA2BDF006F1352 /* DVSlideViewController */, 54 | E3CC29A515AA2BDF006F1352 /* Frameworks */, 55 | E3CC29A315AA2BDF006F1352 /* Products */, 56 | ); 57 | sourceTree = ""; 58 | }; 59 | E3CC29A315AA2BDF006F1352 /* Products */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | E3CC29A215AA2BDF006F1352 /* DVSlideViewController.app */, 63 | ); 64 | name = Products; 65 | sourceTree = ""; 66 | }; 67 | E3CC29A515AA2BDF006F1352 /* Frameworks */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | E3CC29A615AA2BDF006F1352 /* UIKit.framework */, 71 | E3CC29A815AA2BDF006F1352 /* Foundation.framework */, 72 | E3CC29AA15AA2BDF006F1352 /* CoreGraphics.framework */, 73 | ); 74 | name = Frameworks; 75 | sourceTree = ""; 76 | }; 77 | E3CC29AC15AA2BDF006F1352 /* DVSlideViewController */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | E3CC29CD15AB7E4A006F1352 /* grayBackground.png */, 81 | E3CC29B515AA2BDF006F1352 /* AppDelegate.h */, 82 | E3CC29B615AA2BDF006F1352 /* AppDelegate.m */, 83 | E3CC29C615AA2C38006F1352 /* DVSlideViewController.h */, 84 | E3CC29C715AA2C38006F1352 /* DVSlideViewController.m */, 85 | E3CC29AD15AA2BDF006F1352 /* Supporting Files */, 86 | ); 87 | path = DVSlideViewController; 88 | sourceTree = ""; 89 | }; 90 | E3CC29AD15AA2BDF006F1352 /* Supporting Files */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | E3CC29AE15AA2BDF006F1352 /* DVSlideViewController-Info.plist */, 94 | E3CC29AF15AA2BDF006F1352 /* InfoPlist.strings */, 95 | E3CC29B215AA2BDF006F1352 /* main.m */, 96 | E3CC29B415AA2BDF006F1352 /* DVSlideViewController-Prefix.pch */, 97 | ); 98 | name = "Supporting Files"; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | E3CC29A115AA2BDF006F1352 /* DVSlideViewController */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = E3CC29C315AA2BDF006F1352 /* Build configuration list for PBXNativeTarget "DVSlideViewController" */; 107 | buildPhases = ( 108 | E3CC299E15AA2BDF006F1352 /* Sources */, 109 | E3CC299F15AA2BDF006F1352 /* Frameworks */, 110 | E3CC29A015AA2BDF006F1352 /* Resources */, 111 | ); 112 | buildRules = ( 113 | ); 114 | dependencies = ( 115 | ); 116 | name = DVSlideViewController; 117 | productName = DVSlideViewController; 118 | productReference = E3CC29A215AA2BDF006F1352 /* DVSlideViewController.app */; 119 | productType = "com.apple.product-type.application"; 120 | }; 121 | /* End PBXNativeTarget section */ 122 | 123 | /* Begin PBXProject section */ 124 | E3CC299915AA2BDF006F1352 /* Project object */ = { 125 | isa = PBXProject; 126 | attributes = { 127 | LastUpgradeCheck = 0430; 128 | }; 129 | buildConfigurationList = E3CC299C15AA2BDF006F1352 /* Build configuration list for PBXProject "DVSlideViewController" */; 130 | compatibilityVersion = "Xcode 3.2"; 131 | developmentRegion = English; 132 | hasScannedForEncodings = 0; 133 | knownRegions = ( 134 | en, 135 | ); 136 | mainGroup = E3CC299715AA2BDF006F1352; 137 | productRefGroup = E3CC29A315AA2BDF006F1352 /* Products */; 138 | projectDirPath = ""; 139 | projectRoot = ""; 140 | targets = ( 141 | E3CC29A115AA2BDF006F1352 /* DVSlideViewController */, 142 | ); 143 | }; 144 | /* End PBXProject section */ 145 | 146 | /* Begin PBXResourcesBuildPhase section */ 147 | E3CC29A015AA2BDF006F1352 /* Resources */ = { 148 | isa = PBXResourcesBuildPhase; 149 | buildActionMask = 2147483647; 150 | files = ( 151 | E3CC29B115AA2BDF006F1352 /* InfoPlist.strings in Resources */, 152 | E3CC29CE15AB7E4A006F1352 /* grayBackground.png in Resources */, 153 | ); 154 | runOnlyForDeploymentPostprocessing = 0; 155 | }; 156 | /* End PBXResourcesBuildPhase section */ 157 | 158 | /* Begin PBXSourcesBuildPhase section */ 159 | E3CC299E15AA2BDF006F1352 /* Sources */ = { 160 | isa = PBXSourcesBuildPhase; 161 | buildActionMask = 2147483647; 162 | files = ( 163 | E3CC29B315AA2BDF006F1352 /* main.m in Sources */, 164 | E3CC29B715AA2BDF006F1352 /* AppDelegate.m in Sources */, 165 | E3CC29C815AA2E1E006F1352 /* DVSlideViewController.m in Sources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXSourcesBuildPhase section */ 170 | 171 | /* Begin PBXVariantGroup section */ 172 | E3CC29AF15AA2BDF006F1352 /* InfoPlist.strings */ = { 173 | isa = PBXVariantGroup; 174 | children = ( 175 | E3CC29B015AA2BDF006F1352 /* en */, 176 | ); 177 | name = InfoPlist.strings; 178 | sourceTree = ""; 179 | }; 180 | /* End PBXVariantGroup section */ 181 | 182 | /* Begin XCBuildConfiguration section */ 183 | E3CC29C115AA2BDF006F1352 /* Debug */ = { 184 | isa = XCBuildConfiguration; 185 | buildSettings = { 186 | ALWAYS_SEARCH_USER_PATHS = NO; 187 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 188 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 189 | COPY_PHASE_STRIP = NO; 190 | GCC_C_LANGUAGE_STANDARD = gnu99; 191 | GCC_DYNAMIC_NO_PIC = NO; 192 | GCC_OPTIMIZATION_LEVEL = 0; 193 | GCC_PREPROCESSOR_DEFINITIONS = ( 194 | "DEBUG=1", 195 | "$(inherited)", 196 | ); 197 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 198 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 199 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 200 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 201 | GCC_WARN_UNUSED_VARIABLE = YES; 202 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 203 | SDKROOT = iphoneos; 204 | TARGETED_DEVICE_FAMILY = "1,2"; 205 | }; 206 | name = Debug; 207 | }; 208 | E3CC29C215AA2BDF006F1352 /* Release */ = { 209 | isa = XCBuildConfiguration; 210 | buildSettings = { 211 | ALWAYS_SEARCH_USER_PATHS = NO; 212 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 213 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 214 | COPY_PHASE_STRIP = YES; 215 | GCC_C_LANGUAGE_STANDARD = gnu99; 216 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 217 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 218 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 219 | GCC_WARN_UNUSED_VARIABLE = YES; 220 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 221 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 222 | SDKROOT = iphoneos; 223 | TARGETED_DEVICE_FAMILY = "1,2"; 224 | VALIDATE_PRODUCT = YES; 225 | }; 226 | name = Release; 227 | }; 228 | E3CC29C415AA2BDF006F1352 /* Debug */ = { 229 | isa = XCBuildConfiguration; 230 | buildSettings = { 231 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 232 | GCC_PREFIX_HEADER = "DVSlideViewController/DVSlideViewController-Prefix.pch"; 233 | INFOPLIST_FILE = "DVSlideViewController/DVSlideViewController-Info.plist"; 234 | PRODUCT_NAME = "$(TARGET_NAME)"; 235 | WRAPPER_EXTENSION = app; 236 | }; 237 | name = Debug; 238 | }; 239 | E3CC29C515AA2BDF006F1352 /* Release */ = { 240 | isa = XCBuildConfiguration; 241 | buildSettings = { 242 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 243 | GCC_PREFIX_HEADER = "DVSlideViewController/DVSlideViewController-Prefix.pch"; 244 | INFOPLIST_FILE = "DVSlideViewController/DVSlideViewController-Info.plist"; 245 | PRODUCT_NAME = "$(TARGET_NAME)"; 246 | WRAPPER_EXTENSION = app; 247 | }; 248 | name = Release; 249 | }; 250 | /* End XCBuildConfiguration section */ 251 | 252 | /* Begin XCConfigurationList section */ 253 | E3CC299C15AA2BDF006F1352 /* Build configuration list for PBXProject "DVSlideViewController" */ = { 254 | isa = XCConfigurationList; 255 | buildConfigurations = ( 256 | E3CC29C115AA2BDF006F1352 /* Debug */, 257 | E3CC29C215AA2BDF006F1352 /* Release */, 258 | ); 259 | defaultConfigurationIsVisible = 0; 260 | defaultConfigurationName = Release; 261 | }; 262 | E3CC29C315AA2BDF006F1352 /* Build configuration list for PBXNativeTarget "DVSlideViewController" */ = { 263 | isa = XCConfigurationList; 264 | buildConfigurations = ( 265 | E3CC29C415AA2BDF006F1352 /* Debug */, 266 | E3CC29C515AA2BDF006F1352 /* Release */, 267 | ); 268 | defaultConfigurationIsVisible = 0; 269 | defaultConfigurationName = Release; 270 | }; 271 | /* End XCConfigurationList section */ 272 | }; 273 | rootObject = E3CC299915AA2BDF006F1352 /* Project object */; 274 | } 275 | -------------------------------------------------------------------------------- /DVSlideViewController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DVSlideViewController.xcodeproj/project.xcworkspace/xcuserdata/dickverbunt.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dickverbunt/DVSlideViewController/f4d4d17bcc39694fe9f871cdb6fd8266869a80c7/DVSlideViewController.xcodeproj/project.xcworkspace/xcuserdata/dickverbunt.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DVSlideViewController.xcodeproj/xcuserdata/dickverbunt.xcuserdatad/xcschemes/DVSlideViewController.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 50 | 51 | 57 | 58 | 59 | 60 | 61 | 62 | 68 | 69 | 75 | 76 | 77 | 78 | 80 | 81 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /DVSlideViewController.xcodeproj/xcuserdata/dickverbunt.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DVSlideViewController.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | E3CC29A115AA2BDF006F1352 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /DVSlideViewController/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DVSlideViewController 4 | // 5 | // Created by Dick Verbunt on 7/8/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DVSlideViewController; 12 | 13 | @interface AppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) DVSlideViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /DVSlideViewController/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DVSlideViewController 4 | // 5 | // Created by Dick Verbunt on 7/8/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "DVSlideViewController.h" 12 | 13 | @implementation AppDelegate 14 | 15 | @synthesize window = _window; 16 | @synthesize viewController = _viewController; 17 | 18 | - (void)dealloc 19 | { 20 | [_window release]; 21 | [_viewController release]; 22 | [super dealloc]; 23 | } 24 | 25 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 26 | { 27 | [[UIApplication sharedApplication] setStatusBarHidden:YES]; 28 | 29 | self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 30 | // Override point for customization after application launch. 31 | 32 | NSMutableArray *viewControllers = [NSMutableArray array]; 33 | for (int i = 0; i < 5; i++) 34 | { 35 | UIViewController *viewController = [[[UIViewController alloc] init] autorelease]; 36 | viewController.view.backgroundColor = [UIColor colorWithWhite:(i / 10.f) alpha:1.0]; 37 | [viewControllers addObject:viewController]; 38 | } 39 | 40 | self.viewController = [[DVSlideViewController alloc] init]; 41 | self.viewController.viewControllers = viewControllers; 42 | 43 | self.window.rootViewController = self.viewController; 44 | [self.window makeKeyAndVisible]; 45 | return YES; 46 | } 47 | 48 | - (void)applicationWillResignActive:(UIApplication *)application 49 | { 50 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 51 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 52 | } 53 | 54 | - (void)applicationDidEnterBackground:(UIApplication *)application 55 | { 56 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 57 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 58 | } 59 | 60 | - (void)applicationWillEnterForeground:(UIApplication *)application 61 | { 62 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 63 | } 64 | 65 | - (void)applicationDidBecomeActive:(UIApplication *)application 66 | { 67 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 68 | } 69 | 70 | - (void)applicationWillTerminate:(UIApplication *)application 71 | { 72 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /DVSlideViewController/DVSlideViewController-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | nl.dickverbunt.${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 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | UIInterfaceOrientationPortraitUpsideDown 37 | 38 | UISupportedInterfaceOrientations~ipad 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationPortraitUpsideDown 42 | UIInterfaceOrientationLandscapeLeft 43 | UIInterfaceOrientationLandscapeRight 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /DVSlideViewController/DVSlideViewController-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'DVSlideViewController' target in the 'DVSlideViewController' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /DVSlideViewController/DVSlideViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DVSlideViewController.h 3 | // ToolBar 4 | // 5 | // Created by Dick Verbunt on 6/11/12. 6 | // Copyright (c) 2012 Dickverbunt. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DVSlideViewController : UIViewController 12 | 13 | @property (nonatomic, retain) NSMutableArray *viewControllers; 14 | @property (nonatomic, readonly) NSUInteger selectedIndex; 15 | @property (nonatomic, assign) CGFloat scaleFactor; 16 | 17 | - (id)init; 18 | - (void)nextViewController; 19 | - (void)prevViewController; 20 | 21 | @end 22 | 23 | 24 | //Making the parrent slideViewController available in the UIViewController 25 | @interface UIViewController (DVSlideViewController) 26 | 27 | @property (nonatomic, readonly, retain) DVSlideViewController *slideViewController; 28 | 29 | @end -------------------------------------------------------------------------------- /DVSlideViewController/DVSlideViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DVSlideViewController.m 3 | // DVSlideViewController 4 | // 5 | // Created by Dick Verbunt on 6/11/12. 6 | // Copyright (c) 2012 Dickverbunt. All rights reserved. 7 | // 8 | 9 | #import "DVSlideViewController.h" 10 | #import 11 | #import 12 | 13 | @interface DVSlideViewController () 14 | { 15 | UIScrollView *viewsContainer; 16 | } 17 | @end 18 | 19 | @implementation DVSlideViewController 20 | 21 | @synthesize viewControllers = _viewControllers; 22 | @synthesize selectedIndex = _selectedIndex; 23 | @synthesize scaleFactor = _scaleFactor; 24 | 25 | - (id)init 26 | { 27 | self = [super init]; 28 | if (self) 29 | { 30 | _selectedIndex = 0; 31 | _scaleFactor = 0.8; 32 | } 33 | 34 | return self; 35 | } 36 | 37 | - (void)loadView 38 | { 39 | [super loadView]; 40 | 41 | [self setupViews]; 42 | [self setupViewControllers]; 43 | } 44 | 45 | - (void)setupViews 46 | { 47 | UIView *background = [[UIView alloc] initWithFrame:self.view.bounds]; 48 | [background setAutoresizingMask:(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth)]; 49 | [background setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"grayBackground"]]]; 50 | [self.view addSubview:background]; 51 | [background release]; 52 | 53 | viewsContainer = [[UIScrollView alloc] initWithFrame:self.view.bounds]; 54 | viewsContainer.delegate = self; 55 | viewsContainer.showsHorizontalScrollIndicator = FALSE; 56 | viewsContainer.pagingEnabled = TRUE; 57 | [viewsContainer setAutoresizingMask:(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth)]; 58 | [self.view addSubview:viewsContainer]; 59 | } 60 | 61 | - (void)setupViewControllers 62 | { 63 | NSUInteger i = 0; 64 | for (UIViewController *viewController in self.viewControllers) { 65 | [self addViewController:viewController atIndex:i]; 66 | i++; 67 | } 68 | } 69 | 70 | - (void)setViewControllers:(NSMutableArray *)controllers 71 | { 72 | for (UIViewController *viewController in _viewControllers) 73 | { 74 | [viewController.view removeFromSuperview]; 75 | } 76 | 77 | [_viewControllers autorelease]; 78 | _viewControllers = [controllers retain]; 79 | _selectedIndex = 0; 80 | 81 | 82 | if (self.isViewLoaded) 83 | { 84 | [self setupViewControllers]; 85 | } 86 | } 87 | 88 | - (void)addViewController:(UIViewController *)viewController atIndex:(int)index; 89 | { 90 | viewController.view.frame = CGRectMake(self.view.bounds.size.width * index, 0, self.view.frame.size.width, self.view.frame.size.height); 91 | viewController.view.backgroundColor = [UIColor colorWithWhite:(index + 1) * 0.2 alpha:1.0]; 92 | [viewsContainer addSubview:viewController.view]; 93 | if ([viewController respondsToSelector:@selector(setSlideViewController:)]) { 94 | [viewController performSelector:@selector(setSlideViewController:) withObject:self]; 95 | } 96 | 97 | UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(changeViewController:)]; 98 | [swipeLeft setDirection:UISwipeGestureRecognizerDirectionLeft]; 99 | [viewController.view addGestureRecognizer:swipeLeft]; 100 | [swipeLeft release]; 101 | 102 | UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(changeViewController:)]; 103 | [swipeRight setDirection:UISwipeGestureRecognizerDirectionRight]; 104 | [viewController.view addGestureRecognizer:swipeRight]; 105 | [swipeRight release]; 106 | } 107 | 108 | - (void)changeViewController:(UISwipeGestureRecognizer *)gesture 109 | { 110 | NSUInteger nextIndex = _selectedIndex; 111 | 112 | if (gesture.direction == UISwipeGestureRecognizerDirectionLeft) 113 | nextIndex++; 114 | else if (gesture.direction == UISwipeGestureRecognizerDirectionRight) 115 | nextIndex--; 116 | 117 | if (nextIndex >= _viewControllers.count || nextIndex == -1) 118 | return; 119 | 120 | [self slideToViewControllerAtIndex:nextIndex]; 121 | } 122 | 123 | - (UIViewController *)viewControllerWithIndex:(NSUInteger)index 124 | { 125 | UIViewController *viewController = nil; 126 | 127 | if (_viewControllers.count > index) 128 | { 129 | viewController = [_viewControllers objectAtIndex:index]; 130 | } 131 | 132 | return viewController; 133 | } 134 | 135 | - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 136 | { 137 | for (int i = 0; i < _viewControllers.count; i++) 138 | { 139 | UIViewController *viewController = [_viewControllers objectAtIndex:i]; 140 | viewController.view.frame = CGRectMake(self.view.bounds.size.width * i, 141 | 0, 142 | self.view.bounds.size.width, 143 | self.view.bounds.size.height); 144 | 145 | //Recalulate shadow 146 | viewController.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:viewController.view.bounds].CGPath; 147 | } 148 | 149 | viewsContainer.contentOffset = CGPointMake(_selectedIndex * self.view.bounds.size.width, viewsContainer.contentOffset.y); 150 | } 151 | 152 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 153 | { 154 | return YES; 155 | } 156 | 157 | #pragma mark - Animations 158 | 159 | - (void)slideToViewControllerAtIndex:(NSUInteger)toIndex 160 | { 161 | UIViewController *currentViewController = [self viewControllerWithIndex:_selectedIndex]; 162 | UIViewController *nextViewController = [self viewControllerWithIndex:toIndex]; 163 | 164 | if (nextViewController == nil) 165 | return; 166 | 167 | CGPoint toPoint = viewsContainer.contentOffset; 168 | toPoint.x = toIndex * viewsContainer.bounds.size.width; 169 | 170 | //Start positions 171 | nextViewController.view.transform = CGAffineTransformMakeScale(_scaleFactor, _scaleFactor); 172 | 173 | currentViewController.view.layer.masksToBounds = NO; 174 | currentViewController.view.layer.shadowRadius = 10; 175 | currentViewController.view.layer.shadowOpacity = 0.5; 176 | currentViewController.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:currentViewController.view.bounds].CGPath; 177 | currentViewController.view.layer.shadowOffset = CGSizeMake(5.0, 5.0); 178 | 179 | [currentViewController viewWillDisappear:YES]; 180 | 181 | //Zoom out animation 182 | [UIView animateWithDuration:0.25 183 | delay:0.0 184 | options:UIViewAnimationCurveEaseInOut 185 | animations:^{ 186 | currentViewController.view.transform = CGAffineTransformMakeScale(_scaleFactor, _scaleFactor); 187 | } 188 | completion:^(BOOL completed){ 189 | 190 | //Add shadow to next view controller 191 | nextViewController.view.layer.masksToBounds = NO; 192 | nextViewController.view.layer.shadowRadius = 10; 193 | nextViewController.view.layer.shadowOpacity = 0.5; 194 | nextViewController.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:nextViewController.view.bounds].CGPath; 195 | nextViewController.view.layer.shadowOffset = CGSizeMake(5.0, 5.0); 196 | 197 | [nextViewController viewWillAppear:YES]; 198 | }]; 199 | 200 | 201 | //Slide animation 202 | [UIView animateWithDuration:0.5 203 | delay:0.25 204 | options:UIViewAnimationCurveEaseInOut 205 | animations:^{ 206 | [viewsContainer setContentOffset:toPoint]; 207 | } 208 | completion:^(BOOL completed){ 209 | 210 | //remove current view controller 211 | currentViewController.view.layer.masksToBounds = YES; 212 | currentViewController.view.layer.shadowRadius = 10; 213 | currentViewController.view.layer.shadowOpacity = 0.0; 214 | currentViewController.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:currentViewController.view.bounds].CGPath; 215 | currentViewController.view.layer.shadowOffset = CGSizeMake(0.0, 0.0); 216 | 217 | [self calculateSelectedIndex]; 218 | 219 | [currentViewController viewDidDisappear:YES]; 220 | }]; 221 | 222 | //Zoom in animation 223 | [UIView animateWithDuration:0.25 224 | delay:0.75 225 | options:UIViewAnimationCurveEaseInOut 226 | animations:^{ 227 | nextViewController.view.transform = CGAffineTransformMakeScale(1.0, 1.0); 228 | } 229 | completion:^(BOOL completed){ 230 | currentViewController.view.transform = CGAffineTransformMakeScale(1.0, 1.0); 231 | 232 | //remove shadow next view controller 233 | nextViewController.view.layer.masksToBounds = YES; 234 | nextViewController.view.layer.shadowRadius = 0.0; 235 | nextViewController.view.layer.shadowOpacity = 0.0; 236 | nextViewController.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:nextViewController.view.bounds].CGPath; 237 | nextViewController.view.layer.shadowOffset = CGSizeMake(0.0, 0.0); 238 | 239 | [nextViewController viewDidAppear:YES]; 240 | }]; 241 | } 242 | 243 | #pragma mark - UIScrollView Delegate 244 | 245 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView 246 | { 247 | [self calculateSelectedIndex]; 248 | } 249 | 250 | - (void)calculateSelectedIndex 251 | { 252 | _selectedIndex = floor((viewsContainer.contentOffset.x - self.view.bounds.size.width / 2) / self.view.bounds.size.width) + 1; 253 | } 254 | 255 | #pragma mark - Controller methods 256 | 257 | - (void)nextViewController 258 | { 259 | [self slideToViewControllerAtIndex:_selectedIndex + 1]; 260 | } 261 | 262 | - (void)prevViewController 263 | { 264 | [self slideToViewControllerAtIndex:_selectedIndex - 1]; 265 | } 266 | 267 | @end 268 | 269 | 270 | #pragma mark - UViewController+DVSlideViewController 271 | 272 | @implementation UIViewController (DVSlideViewController) 273 | 274 | NSString const * kSlideViewController = @"slideViewController"; 275 | 276 | - (DVSlideViewController *)slideViewController { 277 | return (DVSlideViewController *)objc_getAssociatedObject(self, kSlideViewController); 278 | } 279 | 280 | - (void)setSlideViewController:(DVSlideViewController *)slideViewController { 281 | objc_setAssociatedObject(self, kSlideViewController, slideViewController, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 282 | } 283 | 284 | @end -------------------------------------------------------------------------------- /DVSlideViewController/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /DVSlideViewController/grayBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dickverbunt/DVSlideViewController/f4d4d17bcc39694fe9f871cdb6fd8266869a80c7/DVSlideViewController/grayBackground.png -------------------------------------------------------------------------------- /DVSlideViewController/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DVSlideViewController 4 | // 5 | // Created by Dick Verbunt on 7/8/12. 6 | // Copyright (c) 2012 __MyCompanyName__. 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 | -------------------------------------------------------------------------------- /LICENSE.markdown: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Dick Verbunt 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | # DVSlideViewController 2 | 3 | by Dick Verbunt 4 | 5 | ## What is DVSlideViewController 6 | 7 | DVSlideViewController is an view controller, witch allows you to slide view controllers in- and offscreen with a swipe of your finger. 8 | 9 | ![](https://github.com/dickverbunt/DVSlideViewController/raw/master/Screenshots/DVSlideViewController_Screenshot1.png) 10 | ![](https://github.com/dickverbunt/DVSlideViewController/raw/master/Screenshots/DVSlideViewController_Screenshot2.png) 11 | [watch a sample of DVSlideViewController on YouTube](http://www.youtube.com/watch?v=p-HCUMs3fTA) 12 | 13 | ## Getting started 14 | 15 | DVSlideViewController includes a demo application, showing how to create and configure an DVSlideViewController. 16 | 17 | Essentially, DVSlideViewContoller is a UIViewController subclass. 18 | 19 | The files you'll need to copy into your own project are in the 'DVSlideViewController' group in the Xcode project. 20 | 21 | 1. Add `QuartzCore.framework` to your target 22 | 2. Add `DVSlideViewController.h`, `DVSlideViewController.m` and `grayBackground.png` to your project 23 | 24 | You also need to include QuartzCore to your project. 25 | The remaining files in the Xcode project are included for demonstration purposes only. 26 | 27 | ## Working with DVSlideViewController 28 | 29 | ```objective-c 30 | //DVSlideViewController 31 | - (void)setViewController:(NSArray *)_viewControllers; 32 | - (void)nextViewController; 33 | - (void)prevViewController; 34 | ``` 35 | 36 | If you add `DVSlideViewController.h` to your childViewController `self.slideViewController` will become available. 37 | 38 | 39 | ## Downloading the code 40 | 41 | You can [get DVSlideViewController on github](http://github.com/dickverbunt/DVSlideViewController). 42 | 43 | 44 | 45 | ## License 46 | 47 | DVSlideViewController is released under the BSD-License. So free of charge. 48 | 49 | 50 | ## Support, bugs and feature requests 51 | 52 | There is absolutely **no support** offered with this component. You're on your own! If you want to submit a feature request, please do so via [the issue tracker on github](http://github.com/dickverbunt/DVSlideViewController/issues). 53 | 54 | If you want to submit a bug report, please also do so via the issue tracker, including a diagnosis of the problem and a suggested fix (in code). If you're using DVSlideViewController, you're a developer - so I expect you to do your homework and provide a fix along with each bug report. You can also submit pull requests or patches. 55 | 56 | Please don't submit bug reports without fixes! -------------------------------------------------------------------------------- /Screenshots/DVSlideViewController_Screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dickverbunt/DVSlideViewController/f4d4d17bcc39694fe9f871cdb6fd8266869a80c7/Screenshots/DVSlideViewController_Screenshot1.png -------------------------------------------------------------------------------- /Screenshots/DVSlideViewController_Screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dickverbunt/DVSlideViewController/f4d4d17bcc39694fe9f871cdb6fd8266869a80c7/Screenshots/DVSlideViewController_Screenshot2.png --------------------------------------------------------------------------------