├── DrawerMenuController Controller.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── DrawerMenuController Controller.xccheckout │ └── xcuserdata │ │ ├── sunset.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── zhaokaiyuan.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── sunset.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ ├── DrawerMenuController Controller.xcscheme │ │ └── xcschememanagement.plist │ └── zhaokaiyuan.xcuserdatad │ └── xcschemes │ ├── DrawerMenuController Controller.xcscheme │ └── xcschememanagement.plist ├── DrawerMenuController Controller ├── 1.png ├── AppDelegate.swift ├── CustomMenuController.swift ├── DrawerMenuController.swift ├── DrawerMenuExplain.swift ├── FirstViewController.swift ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── LaunchImage.launchimage │ │ └── Contents.json │ ├── first.imageset │ │ ├── Contents.json │ │ ├── first.png │ │ └── first@2x.png │ └── second.imageset │ │ ├── Contents.json │ │ ├── second.png │ │ └── second@2x.png ├── Info.plist ├── MainViewController.swift ├── RootController.swift └── SecondViewController.swift └── DrawerMenuController ControllerTests ├── DrawerMenuController_ControllerTests.swift └── Info.plist /DrawerMenuController Controller.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | CB324C981976112900D139BF /* RootController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB324C971976112900D139BF /* RootController.swift */; }; 11 | CB61ECB11974CAAF002457B3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB61ECB01974CAAF002457B3 /* AppDelegate.swift */; }; 12 | CB61ECB31974CAAF002457B3 /* FirstViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB61ECB21974CAAF002457B3 /* FirstViewController.swift */; }; 13 | CB61ECB51974CAAF002457B3 /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB61ECB41974CAAF002457B3 /* SecondViewController.swift */; }; 14 | CB61ECBA1974CAAF002457B3 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CB61ECB91974CAAF002457B3 /* Images.xcassets */; }; 15 | CB61ECC61974CAAF002457B3 /* DrawerMenuController_ControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB61ECC51974CAAF002457B3 /* DrawerMenuController_ControllerTests.swift */; }; 16 | CB61ECD11974CAEE002457B3 /* DrawerMenuController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB61ECD01974CAEE002457B3 /* DrawerMenuController.swift */; }; 17 | CBD1B2151978C997002A2356 /* CustomMenuController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBD1B2141978C997002A2356 /* CustomMenuController.swift */; }; 18 | CBD1B2171978CEDC002A2356 /* 1.png in Resources */ = {isa = PBXBuildFile; fileRef = CBD1B2161978CEDC002A2356 /* 1.png */; }; 19 | CBD1B2191978E817002A2356 /* DrawerMenuExplain.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBD1B2181978E817002A2356 /* DrawerMenuExplain.swift */; }; 20 | CBD1B21B1978EA46002A2356 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBD1B21A1978EA46002A2356 /* MainViewController.swift */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | CB61ECC01974CAAF002457B3 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = CB61ECA31974CAAE002457B3 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = CB61ECAA1974CAAF002457B3; 29 | remoteInfo = "DrawerMenuController Controller"; 30 | }; 31 | /* End PBXContainerItemProxy section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | CB324C971976112900D139BF /* RootController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RootController.swift; sourceTree = ""; }; 35 | CB61ECAB1974CAAF002457B3 /* DrawerMenuController Controller.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DrawerMenuController Controller.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | CB61ECAF1974CAAF002457B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | CB61ECB01974CAAF002457B3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 38 | CB61ECB21974CAAF002457B3 /* FirstViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstViewController.swift; sourceTree = ""; }; 39 | CB61ECB41974CAAF002457B3 /* SecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondViewController.swift; sourceTree = ""; }; 40 | CB61ECB91974CAAF002457B3 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 41 | CB61ECBF1974CAAF002457B3 /* DrawerMenuController ControllerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "DrawerMenuController ControllerTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | CB61ECC41974CAAF002457B3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | CB61ECC51974CAAF002457B3 /* DrawerMenuController_ControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DrawerMenuController_ControllerTests.swift; sourceTree = ""; }; 44 | CB61ECD01974CAEE002457B3 /* DrawerMenuController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DrawerMenuController.swift; sourceTree = ""; }; 45 | CBD1B2141978C997002A2356 /* CustomMenuController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomMenuController.swift; sourceTree = ""; }; 46 | CBD1B2161978CEDC002A2356 /* 1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = 1.png; sourceTree = ""; }; 47 | CBD1B2181978E817002A2356 /* DrawerMenuExplain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DrawerMenuExplain.swift; sourceTree = ""; }; 48 | CBD1B21A1978EA46002A2356 /* MainViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = ""; }; 49 | /* End PBXFileReference section */ 50 | 51 | /* Begin PBXFrameworksBuildPhase section */ 52 | CB61ECA81974CAAF002457B3 /* Frameworks */ = { 53 | isa = PBXFrameworksBuildPhase; 54 | buildActionMask = 2147483647; 55 | files = ( 56 | ); 57 | runOnlyForDeploymentPostprocessing = 0; 58 | }; 59 | CB61ECBC1974CAAF002457B3 /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXFrameworksBuildPhase section */ 67 | 68 | /* Begin PBXGroup section */ 69 | CB61ECA21974CAAE002457B3 = { 70 | isa = PBXGroup; 71 | children = ( 72 | CB61ECAD1974CAAF002457B3 /* DrawerMenuController Controller */, 73 | CB61ECC21974CAAF002457B3 /* DrawerMenuController ControllerTests */, 74 | CB61ECAC1974CAAF002457B3 /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | CB61ECAC1974CAAF002457B3 /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | CB61ECAB1974CAAF002457B3 /* DrawerMenuController Controller.app */, 82 | CB61ECBF1974CAAF002457B3 /* DrawerMenuController ControllerTests.xctest */, 83 | ); 84 | name = Products; 85 | sourceTree = ""; 86 | }; 87 | CB61ECAD1974CAAF002457B3 /* DrawerMenuController Controller */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | CB61ECCF1974CACE002457B3 /* DrawerMenuController */, 91 | CB61ECB01974CAAF002457B3 /* AppDelegate.swift */, 92 | CB324C971976112900D139BF /* RootController.swift */, 93 | CBD1B21A1978EA46002A2356 /* MainViewController.swift */, 94 | CB61ECB21974CAAF002457B3 /* FirstViewController.swift */, 95 | CB61ECB41974CAAF002457B3 /* SecondViewController.swift */, 96 | CB61ECB91974CAAF002457B3 /* Images.xcassets */, 97 | CBD1B2161978CEDC002A2356 /* 1.png */, 98 | CB61ECAE1974CAAF002457B3 /* Supporting Files */, 99 | ); 100 | path = "DrawerMenuController Controller"; 101 | sourceTree = ""; 102 | }; 103 | CB61ECAE1974CAAF002457B3 /* Supporting Files */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | CB61ECAF1974CAAF002457B3 /* Info.plist */, 107 | ); 108 | name = "Supporting Files"; 109 | sourceTree = ""; 110 | }; 111 | CB61ECC21974CAAF002457B3 /* DrawerMenuController ControllerTests */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | CB61ECC51974CAAF002457B3 /* DrawerMenuController_ControllerTests.swift */, 115 | CB61ECC31974CAAF002457B3 /* Supporting Files */, 116 | ); 117 | path = "DrawerMenuController ControllerTests"; 118 | sourceTree = ""; 119 | }; 120 | CB61ECC31974CAAF002457B3 /* Supporting Files */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | CB61ECC41974CAAF002457B3 /* Info.plist */, 124 | ); 125 | name = "Supporting Files"; 126 | sourceTree = ""; 127 | }; 128 | CB61ECCF1974CACE002457B3 /* DrawerMenuController */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | CB61ECD01974CAEE002457B3 /* DrawerMenuController.swift */, 132 | CBD1B2141978C997002A2356 /* CustomMenuController.swift */, 133 | CBD1B2181978E817002A2356 /* DrawerMenuExplain.swift */, 134 | ); 135 | name = DrawerMenuController; 136 | sourceTree = ""; 137 | }; 138 | /* End PBXGroup section */ 139 | 140 | /* Begin PBXNativeTarget section */ 141 | CB61ECAA1974CAAF002457B3 /* DrawerMenuController Controller */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = CB61ECC91974CAAF002457B3 /* Build configuration list for PBXNativeTarget "DrawerMenuController Controller" */; 144 | buildPhases = ( 145 | CB61ECA71974CAAF002457B3 /* Sources */, 146 | CB61ECA81974CAAF002457B3 /* Frameworks */, 147 | CB61ECA91974CAAF002457B3 /* Resources */, 148 | ); 149 | buildRules = ( 150 | ); 151 | dependencies = ( 152 | ); 153 | name = "DrawerMenuController Controller"; 154 | productName = "DrawerMenuController Controller"; 155 | productReference = CB61ECAB1974CAAF002457B3 /* DrawerMenuController Controller.app */; 156 | productType = "com.apple.product-type.application"; 157 | }; 158 | CB61ECBE1974CAAF002457B3 /* DrawerMenuController ControllerTests */ = { 159 | isa = PBXNativeTarget; 160 | buildConfigurationList = CB61ECCC1974CAAF002457B3 /* Build configuration list for PBXNativeTarget "DrawerMenuController ControllerTests" */; 161 | buildPhases = ( 162 | CB61ECBB1974CAAF002457B3 /* Sources */, 163 | CB61ECBC1974CAAF002457B3 /* Frameworks */, 164 | CB61ECBD1974CAAF002457B3 /* Resources */, 165 | ); 166 | buildRules = ( 167 | ); 168 | dependencies = ( 169 | CB61ECC11974CAAF002457B3 /* PBXTargetDependency */, 170 | ); 171 | name = "DrawerMenuController ControllerTests"; 172 | productName = "DrawerMenuController ControllerTests"; 173 | productReference = CB61ECBF1974CAAF002457B3 /* DrawerMenuController ControllerTests.xctest */; 174 | productType = "com.apple.product-type.bundle.unit-test"; 175 | }; 176 | /* End PBXNativeTarget section */ 177 | 178 | /* Begin PBXProject section */ 179 | CB61ECA31974CAAE002457B3 /* Project object */ = { 180 | isa = PBXProject; 181 | attributes = { 182 | LastUpgradeCheck = 0600; 183 | ORGANIZATIONNAME = zhaokaiyuan; 184 | TargetAttributes = { 185 | CB61ECAA1974CAAF002457B3 = { 186 | CreatedOnToolsVersion = 6.0; 187 | }; 188 | CB61ECBE1974CAAF002457B3 = { 189 | CreatedOnToolsVersion = 6.0; 190 | TestTargetID = CB61ECAA1974CAAF002457B3; 191 | }; 192 | }; 193 | }; 194 | buildConfigurationList = CB61ECA61974CAAF002457B3 /* Build configuration list for PBXProject "DrawerMenuController Controller" */; 195 | compatibilityVersion = "Xcode 3.2"; 196 | developmentRegion = English; 197 | hasScannedForEncodings = 0; 198 | knownRegions = ( 199 | en, 200 | Base, 201 | ); 202 | mainGroup = CB61ECA21974CAAE002457B3; 203 | productRefGroup = CB61ECAC1974CAAF002457B3 /* Products */; 204 | projectDirPath = ""; 205 | projectRoot = ""; 206 | targets = ( 207 | CB61ECAA1974CAAF002457B3 /* DrawerMenuController Controller */, 208 | CB61ECBE1974CAAF002457B3 /* DrawerMenuController ControllerTests */, 209 | ); 210 | }; 211 | /* End PBXProject section */ 212 | 213 | /* Begin PBXResourcesBuildPhase section */ 214 | CB61ECA91974CAAF002457B3 /* Resources */ = { 215 | isa = PBXResourcesBuildPhase; 216 | buildActionMask = 2147483647; 217 | files = ( 218 | CB61ECBA1974CAAF002457B3 /* Images.xcassets in Resources */, 219 | CBD1B2171978CEDC002A2356 /* 1.png in Resources */, 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | }; 223 | CB61ECBD1974CAAF002457B3 /* Resources */ = { 224 | isa = PBXResourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | ); 228 | runOnlyForDeploymentPostprocessing = 0; 229 | }; 230 | /* End PBXResourcesBuildPhase section */ 231 | 232 | /* Begin PBXSourcesBuildPhase section */ 233 | CB61ECA71974CAAF002457B3 /* Sources */ = { 234 | isa = PBXSourcesBuildPhase; 235 | buildActionMask = 2147483647; 236 | files = ( 237 | CB324C981976112900D139BF /* RootController.swift in Sources */, 238 | CB61ECB51974CAAF002457B3 /* SecondViewController.swift in Sources */, 239 | CB61ECB11974CAAF002457B3 /* AppDelegate.swift in Sources */, 240 | CBD1B21B1978EA46002A2356 /* MainViewController.swift in Sources */, 241 | CB61ECB31974CAAF002457B3 /* FirstViewController.swift in Sources */, 242 | CBD1B2191978E817002A2356 /* DrawerMenuExplain.swift in Sources */, 243 | CB61ECD11974CAEE002457B3 /* DrawerMenuController.swift in Sources */, 244 | CBD1B2151978C997002A2356 /* CustomMenuController.swift in Sources */, 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | CB61ECBB1974CAAF002457B3 /* Sources */ = { 249 | isa = PBXSourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | CB61ECC61974CAAF002457B3 /* DrawerMenuController_ControllerTests.swift in Sources */, 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | }; 256 | /* End PBXSourcesBuildPhase section */ 257 | 258 | /* Begin PBXTargetDependency section */ 259 | CB61ECC11974CAAF002457B3 /* PBXTargetDependency */ = { 260 | isa = PBXTargetDependency; 261 | target = CB61ECAA1974CAAF002457B3 /* DrawerMenuController Controller */; 262 | targetProxy = CB61ECC01974CAAF002457B3 /* PBXContainerItemProxy */; 263 | }; 264 | /* End PBXTargetDependency section */ 265 | 266 | /* Begin XCBuildConfiguration section */ 267 | CB61ECC71974CAAF002457B3 /* Debug */ = { 268 | isa = XCBuildConfiguration; 269 | buildSettings = { 270 | ALWAYS_SEARCH_USER_PATHS = NO; 271 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 272 | CLANG_CXX_LIBRARY = "libc++"; 273 | CLANG_ENABLE_MODULES = YES; 274 | CLANG_ENABLE_OBJC_ARC = YES; 275 | CLANG_WARN_BOOL_CONVERSION = YES; 276 | CLANG_WARN_CONSTANT_CONVERSION = YES; 277 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 278 | CLANG_WARN_EMPTY_BODY = YES; 279 | CLANG_WARN_ENUM_CONVERSION = YES; 280 | CLANG_WARN_INT_CONVERSION = YES; 281 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 282 | CLANG_WARN_UNREACHABLE_CODE = YES; 283 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 284 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 285 | COPY_PHASE_STRIP = NO; 286 | ENABLE_STRICT_OBJC_MSGSEND = YES; 287 | GCC_C_LANGUAGE_STANDARD = gnu99; 288 | GCC_DYNAMIC_NO_PIC = NO; 289 | GCC_OPTIMIZATION_LEVEL = 0; 290 | GCC_PREPROCESSOR_DEFINITIONS = ( 291 | "DEBUG=1", 292 | "$(inherited)", 293 | ); 294 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 295 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 296 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 297 | GCC_WARN_UNDECLARED_SELECTOR = YES; 298 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 299 | GCC_WARN_UNUSED_FUNCTION = YES; 300 | GCC_WARN_UNUSED_VARIABLE = YES; 301 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 302 | MTL_ENABLE_DEBUG_INFO = YES; 303 | ONLY_ACTIVE_ARCH = YES; 304 | SDKROOT = iphoneos; 305 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 306 | }; 307 | name = Debug; 308 | }; 309 | CB61ECC81974CAAF002457B3 /* Release */ = { 310 | isa = XCBuildConfiguration; 311 | buildSettings = { 312 | ALWAYS_SEARCH_USER_PATHS = NO; 313 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 314 | CLANG_CXX_LIBRARY = "libc++"; 315 | CLANG_ENABLE_MODULES = YES; 316 | CLANG_ENABLE_OBJC_ARC = YES; 317 | CLANG_WARN_BOOL_CONVERSION = YES; 318 | CLANG_WARN_CONSTANT_CONVERSION = YES; 319 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 320 | CLANG_WARN_EMPTY_BODY = YES; 321 | CLANG_WARN_ENUM_CONVERSION = YES; 322 | CLANG_WARN_INT_CONVERSION = YES; 323 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 324 | CLANG_WARN_UNREACHABLE_CODE = YES; 325 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 326 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 327 | COPY_PHASE_STRIP = YES; 328 | ENABLE_NS_ASSERTIONS = NO; 329 | ENABLE_STRICT_OBJC_MSGSEND = YES; 330 | GCC_C_LANGUAGE_STANDARD = gnu99; 331 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 332 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 333 | GCC_WARN_UNDECLARED_SELECTOR = YES; 334 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 335 | GCC_WARN_UNUSED_FUNCTION = YES; 336 | GCC_WARN_UNUSED_VARIABLE = YES; 337 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 338 | MTL_ENABLE_DEBUG_INFO = NO; 339 | SDKROOT = iphoneos; 340 | VALIDATE_PRODUCT = YES; 341 | }; 342 | name = Release; 343 | }; 344 | CB61ECCA1974CAAF002457B3 /* Debug */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 348 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 349 | INFOPLIST_FILE = "DrawerMenuController Controller/Info.plist"; 350 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 351 | PRODUCT_NAME = "$(TARGET_NAME)"; 352 | }; 353 | name = Debug; 354 | }; 355 | CB61ECCB1974CAAF002457B3 /* Release */ = { 356 | isa = XCBuildConfiguration; 357 | buildSettings = { 358 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 359 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 360 | INFOPLIST_FILE = "DrawerMenuController Controller/Info.plist"; 361 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 362 | PRODUCT_NAME = "$(TARGET_NAME)"; 363 | }; 364 | name = Release; 365 | }; 366 | CB61ECCD1974CAAF002457B3 /* Debug */ = { 367 | isa = XCBuildConfiguration; 368 | buildSettings = { 369 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/DrawerMenuController Controller.app/DrawerMenuController Controller"; 370 | FRAMEWORK_SEARCH_PATHS = ( 371 | "$(SDKROOT)/Developer/Library/Frameworks", 372 | "$(inherited)", 373 | ); 374 | GCC_PREPROCESSOR_DEFINITIONS = ( 375 | "DEBUG=1", 376 | "$(inherited)", 377 | ); 378 | INFOPLIST_FILE = "DrawerMenuController ControllerTests/Info.plist"; 379 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 380 | PRODUCT_NAME = "$(TARGET_NAME)"; 381 | TEST_HOST = "$(BUNDLE_LOADER)"; 382 | }; 383 | name = Debug; 384 | }; 385 | CB61ECCE1974CAAF002457B3 /* Release */ = { 386 | isa = XCBuildConfiguration; 387 | buildSettings = { 388 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/DrawerMenuController Controller.app/DrawerMenuController Controller"; 389 | FRAMEWORK_SEARCH_PATHS = ( 390 | "$(SDKROOT)/Developer/Library/Frameworks", 391 | "$(inherited)", 392 | ); 393 | INFOPLIST_FILE = "DrawerMenuController ControllerTests/Info.plist"; 394 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 395 | PRODUCT_NAME = "$(TARGET_NAME)"; 396 | TEST_HOST = "$(BUNDLE_LOADER)"; 397 | }; 398 | name = Release; 399 | }; 400 | /* End XCBuildConfiguration section */ 401 | 402 | /* Begin XCConfigurationList section */ 403 | CB61ECA61974CAAF002457B3 /* Build configuration list for PBXProject "DrawerMenuController Controller" */ = { 404 | isa = XCConfigurationList; 405 | buildConfigurations = ( 406 | CB61ECC71974CAAF002457B3 /* Debug */, 407 | CB61ECC81974CAAF002457B3 /* Release */, 408 | ); 409 | defaultConfigurationIsVisible = 0; 410 | defaultConfigurationName = Release; 411 | }; 412 | CB61ECC91974CAAF002457B3 /* Build configuration list for PBXNativeTarget "DrawerMenuController Controller" */ = { 413 | isa = XCConfigurationList; 414 | buildConfigurations = ( 415 | CB61ECCA1974CAAF002457B3 /* Debug */, 416 | CB61ECCB1974CAAF002457B3 /* Release */, 417 | ); 418 | defaultConfigurationIsVisible = 0; 419 | defaultConfigurationName = Release; 420 | }; 421 | CB61ECCC1974CAAF002457B3 /* Build configuration list for PBXNativeTarget "DrawerMenuController ControllerTests" */ = { 422 | isa = XCConfigurationList; 423 | buildConfigurations = ( 424 | CB61ECCD1974CAAF002457B3 /* Debug */, 425 | CB61ECCE1974CAAF002457B3 /* Release */, 426 | ); 427 | defaultConfigurationIsVisible = 0; 428 | defaultConfigurationName = Release; 429 | }; 430 | /* End XCConfigurationList section */ 431 | }; 432 | rootObject = CB61ECA31974CAAE002457B3 /* Project object */; 433 | } 434 | -------------------------------------------------------------------------------- /DrawerMenuController Controller.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DrawerMenuController Controller.xcodeproj/project.xcworkspace/xcshareddata/DrawerMenuController Controller.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 707B83F8-9E7A-4CD9-A191-EA1453674CB5 9 | IDESourceControlProjectName 10 | DrawerMenuController Controller 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | B724938BA919EED3E515469DFAC8F0E453DD8164 14 | https://github.com/zhaokaiyuan99/DrawerMenuController.git 15 | 16 | IDESourceControlProjectPath 17 | DrawerMenuController Controller.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | B724938BA919EED3E515469DFAC8F0E453DD8164 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/zhaokaiyuan99/DrawerMenuController.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | B724938BA919EED3E515469DFAC8F0E453DD8164 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | B724938BA919EED3E515469DFAC8F0E453DD8164 36 | IDESourceControlWCCName 37 | DrawerMenuController 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /DrawerMenuController Controller.xcodeproj/project.xcworkspace/xcuserdata/sunset.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaokaiyuan99/DrawerMenuController/d160bff58345ca00d55543dbf76b21d24bc1b828/DrawerMenuController Controller.xcodeproj/project.xcworkspace/xcuserdata/sunset.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DrawerMenuController Controller.xcodeproj/project.xcworkspace/xcuserdata/zhaokaiyuan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaokaiyuan99/DrawerMenuController/d160bff58345ca00d55543dbf76b21d24bc1b828/DrawerMenuController Controller.xcodeproj/project.xcworkspace/xcuserdata/zhaokaiyuan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DrawerMenuController Controller.xcodeproj/xcuserdata/sunset.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 50 | 51 | 64 | 65 | 66 | 67 | 68 | 70 | 82 | 83 | 84 | 86 | 98 | 99 | 100 | 102 | 112 | 113 | 114 | 116 | 128 | 129 | 142 | 143 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /DrawerMenuController Controller.xcodeproj/xcuserdata/sunset.xcuserdatad/xcschemes/DrawerMenuController Controller.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 | -------------------------------------------------------------------------------- /DrawerMenuController Controller.xcodeproj/xcuserdata/sunset.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DrawerMenuController Controller.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | CB61ECAA1974CAAF002457B3 16 | 17 | primary 18 | 19 | 20 | CB61ECBE1974CAAF002457B3 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /DrawerMenuController Controller.xcodeproj/xcuserdata/zhaokaiyuan.xcuserdatad/xcschemes/DrawerMenuController Controller.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /DrawerMenuController Controller.xcodeproj/xcuserdata/zhaokaiyuan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DrawerMenuController Controller.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | CB61ECAA1974CAAF002457B3 16 | 17 | primary 18 | 19 | 20 | CB61ECBE1974CAAF002457B3 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /DrawerMenuController Controller/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaokaiyuan99/DrawerMenuController/d160bff58345ca00d55543dbf76b21d24bc1b828/DrawerMenuController Controller/1.png -------------------------------------------------------------------------------- /DrawerMenuController Controller/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // DrawerMenuController Controller 4 | // 5 | // Created by SunSet on 14-7-15. 6 | // Copyright (c) 2014年 zhaokaiyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | var menuController:DrawerMenuController? 17 | 18 | 19 | func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool { 20 | 21 | self.window = UIWindow(frame: UIScreen.mainScreen().bounds) 22 | // Override point for customization after application launch. 23 | var mainViewController = RootViewController(nibName:nil, bundle: nil) 24 | var navigationViewController = UINavigationController(rootViewController: mainViewController) 25 | 26 | self.window!.rootViewController = navigationViewController 27 | //self.window!.backgroundColor = UIColor.whiteColor() 28 | self.window!.makeKeyAndVisible() 29 | return true 30 | 31 | } 32 | 33 | func applicationWillResignActive(application: UIApplication!) { 34 | // 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. 35 | // 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. 36 | } 37 | 38 | func applicationDidEnterBackground(application: UIApplication!) { 39 | // 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. 40 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 41 | } 42 | 43 | func applicationWillEnterForeground(application: UIApplication!) { 44 | // 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. 45 | } 46 | 47 | func applicationDidBecomeActive(application: UIApplication!) { 48 | // 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. 49 | } 50 | 51 | func applicationWillTerminate(application: UIApplication!) { 52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 53 | } 54 | 55 | 56 | } 57 | 58 | -------------------------------------------------------------------------------- /DrawerMenuController Controller/CustomMenuController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawerMenuExplain.swift 3 | // DrawerMenuController Controller 4 | // 5 | // Created by SunSet on 14-7-18. 6 | // Copyright (c) 2014年 zhaokaiyuan. All rights reserved. 7 | // qq 623046455 邮箱 zhaokaiyuan99@163.com 8 | 9 | import UIKit 10 | import QuartzCore 11 | //自定义 侧滑 12 | // 13 | class CustomMenuController: DrawerMenuController { 14 | 15 | // 16 | override func layoutCurrentViewWithOffset(xoffset: CGFloat) { 17 | super.layoutCurrentViewWithOffset(xoffset) 18 | if xoffset > 0 { 19 | leftSideView!.frame = CGRectMake( ( -leftSideView!.frame.size.width + xoffset + xoffset / self.leftViewShowWidth * ( leftSideView!.frame.size.width - xoffset) ) , 0, leftSideView!.frame.size.width, leftSideView!.frame.size.height) 20 | leftSideView!.alpha = xoffset/self.leftViewShowWidth 21 | } 22 | } 23 | 24 | override func showLeftViewController(animated: Bool) { 25 | 26 | super.showLeftViewController(true) 27 | 28 | } 29 | 30 | override func showRightViewController(animated: Bool) { 31 | super.showRightViewController(true) 32 | } 33 | 34 | override func hideSideViewController(animated: Bool) { 35 | 36 | UIView.animateWithDuration(0.3, animations: { 37 | var newFrame:CGRect = self.mainContentView!.frame 38 | if newFrame.origin.x < 0 { 39 | newFrame.origin.x = newFrame.origin.x - 30 40 | }else { 41 | newFrame.origin.x = newFrame.origin.x + 30 42 | } 43 | 44 | self.mainContentView!.frame = newFrame 45 | }, completion: { 46 | (finish:Bool) -> Void in 47 | self.close() 48 | }) 49 | 50 | 51 | //super.hideSideViewController(true) 52 | 53 | } 54 | 55 | func close(){ 56 | super.hideSideViewController(true) 57 | } 58 | 59 | 60 | 61 | 62 | 63 | } -------------------------------------------------------------------------------- /DrawerMenuController Controller/DrawerMenuController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawerMenuExplain.swift 3 | // DrawerMenuController Controller 4 | // 5 | // Created by SunSet on 14-7-18. 6 | // Copyright (c) 2014年 zhaokaiyuan. All rights reserved. 7 | // qq 623046455 邮箱 zhaokaiyuan99@163.com 8 | 9 | 10 | import UIKit 11 | 12 | enum MenuDirection { 13 | case leftMenu 14 | case rightMenu 15 | case middleMenu 16 | } 17 | 18 | 19 | 20 | @objc protocol DrawerMenuControllerDelegate : NSObjectProtocol { 21 | 22 | //滑动变化 23 | optional func CustomlayoutViewWithOffset(xoffset:CGFloat,menuController:DrawerMenuController) 24 | } 25 | 26 | 27 | 28 | class DrawerMenuController: UIViewController ,UIGestureRecognizerDelegate { 29 | var delegate:DrawerMenuControllerDelegate? 30 | 31 | 32 | //是否边界影子 33 | var showBoundsShadow:Bool = true { 34 | willSet{ 35 | 36 | } 37 | didSet{ 38 | 39 | } 40 | 41 | } 42 | 43 | //是否能滑动 44 | var needSwipeShowMenu:Bool = true 45 | 46 | { 47 | willSet{ 48 | 49 | } 50 | didSet{ 51 | if needSwipeShowMenu{ 52 | self.view.addGestureRecognizer(movePan!) 53 | }else{ 54 | self.view.removeGestureRecognizer(movePan!) 55 | } 56 | } 57 | 58 | } 59 | 60 | var minScale:CGFloat = 0.8 //root 最小缩放 61 | var leftViewShowWidth:CGFloat = 220 //左边View 长度 62 | var leftSmoothWidth:CGFloat = 80 //滑动是缩放后平滑距离 63 | var rightViewShowWidth:CGFloat = 220 //右边 64 | var rightSmoothWidth:CGFloat = 80 65 | var directionAnimationDuration:CGFloat = 0.8 //左右滑动动画时间 66 | var backAnimationDuration:CGFloat = 0.35 //返回动画时间 67 | var bounces:Bool = true //滑动边界回弹 68 | var springBack:Bool = true //是否支持回弹效果 object—c 只有ios7 以上有效 swift ios7以下未知 没有测试过 69 | var springBackDuration:CGFloat = 0.5 //回弹时间 70 | var SpringVelocity:CGFloat = 0.5 71 | 72 | 73 | var movePan:UIPanGestureRecognizer? 74 | var blackCoverPan:UIPanGestureRecognizer? 75 | var blackTapPan:UITapGestureRecognizer? 76 | 77 | var startPanPoint:CGPoint = CGPointMake(0, 0) 78 | var panMovingRightOrLeft:Bool = false 79 | 80 | var panRight:Bool = false 81 | var panLeft:Bool = false 82 | var isInAnimation:Bool = false 83 | 84 | var menuDirection:MenuDirection = MenuDirection.middleMenu 85 | 86 | var mainContentView:UIView? 87 | var leftSideView:UIView? 88 | var rightSideView:UIView? 89 | var blackCoverView:UIView? 90 | 91 | var rootViewController:UIViewController?{ 92 | willSet{ 93 | if (newValue != nil) { 94 | rootViewController?.removeFromParentViewController() 95 | rootViewController?.view.removeFromSuperview(); 96 | } 97 | } 98 | didSet{ 99 | if (rootViewController != nil){ 100 | self.addChildViewController(rootViewController!) 101 | var frame:CGRect = CGRectZero 102 | var transform:CGAffineTransform = CGAffineTransformIdentity 103 | frame = self.view.bounds; 104 | mainContentView!.addSubview(rootViewController!.view) 105 | mainContentView!.sendSubviewToBack(rootViewController!.view) 106 | rootViewController!.view.transform = transform 107 | rootViewController!.view.frame = frame 108 | if (leftViewController?.view.subviews != nil) { 109 | self.showShadow(showBoundsShadow) 110 | 111 | }else if (rightViewController?.view.subviews != nil) { 112 | 113 | self.showShadow(showBoundsShadow) 114 | } 115 | 116 | } 117 | } 118 | } 119 | 120 | var leftViewController:UIViewController?{ 121 | willSet{ 122 | if (newValue) != nil { 123 | 124 | leftViewController?.removeFromParentViewController() 125 | leftViewController?.view.removeFromSuperview(); 126 | } 127 | 128 | } 129 | didSet{ 130 | if (leftViewController != nil){ 131 | self.addChildViewController(leftViewController!) 132 | leftViewController!.view.frame = CGRectMake(0, 0, leftViewController!.view.frame.size.width, leftViewController!.view.frame.size.height) 133 | leftSideView!.addSubview(leftViewController!.view) 134 | } 135 | } 136 | } 137 | 138 | var rightViewController:UIViewController?{ 139 | willSet{ 140 | if (newValue != nil) { 141 | rightViewController?.removeFromParentViewController() 142 | rightViewController?.view.removeFromSuperview(); 143 | } 144 | } 145 | didSet{ 146 | if (rightViewController != nil){ 147 | self.addChildViewController(rightViewController!) 148 | rightViewController!.view.frame = CGRectMake(0, 0, rightViewController!.view.frame.size.width, rightViewController!.view.frame.size.height) 149 | rightSideView!.addSubview(rightViewController!.view) 150 | } 151 | } 152 | } 153 | 154 | func showShadow(show: Bool) 155 | { 156 | mainContentView!.layer.shadowOpacity = show ? 0.8 : 0.0 157 | if show { 158 | mainContentView!.layer.cornerRadius = 0.4 159 | mainContentView!.layer.cornerRadius = 0.4 160 | mainContentView!.layer.shadowOffset = CGSizeZero; 161 | mainContentView!.layer.shadowRadius = 4.0; 162 | mainContentView!.layer.shadowPath = UIBezierPath(rect: mainContentView!.bounds).CGPath 163 | } 164 | } 165 | 166 | override func viewDidLoad() { 167 | super.viewDidLoad() 168 | 169 | self.initSubviews() 170 | 171 | //滑动手势 172 | movePan = UIPanGestureRecognizer(target: self, action: "moveViewWithGesture:") 173 | movePan!.delegate = self 174 | mainContentView!.addGestureRecognizer(movePan!) 175 | 176 | 177 | 178 | blackTapPan = UITapGestureRecognizer(target: self, action: "handleSingleFingerEvent:") 179 | blackTapPan!.numberOfTouchesRequired = 1; //手指数 180 | blackTapPan!.numberOfTapsRequired = 1; //tap次数 181 | blackTapPan!.delegate = self 182 | blackCoverView!.addGestureRecognizer(blackTapPan!) 183 | blackTapPan!.enabled = false 184 | 185 | 186 | blackCoverPan = UIPanGestureRecognizer(target: self, action: "blackCoverGesture:") 187 | blackCoverPan!.delegate = self 188 | blackCoverView!.addGestureRecognizer(blackCoverPan!) 189 | blackCoverPan!.enabled = false 190 | 191 | 192 | } 193 | 194 | override func didReceiveMemoryWarning() { 195 | super.didReceiveMemoryWarning() 196 | // Dispose of any resources that can be recreated. 197 | } 198 | 199 | func initSubviews(){ 200 | leftSideView = UIView(frame: self.view.bounds) 201 | self.view.addSubview(leftSideView!) 202 | rightSideView = UIView(frame: self.view.bounds) 203 | self.view.addSubview(rightSideView!) 204 | mainContentView = UIView(frame: self.view.bounds) 205 | self.view.addSubview(mainContentView!) 206 | blackCoverView = UIView(frame: self.view.bounds) 207 | mainContentView!.addSubview(blackCoverView!) 208 | blackCoverView!.backgroundColor = UIColor.blackColor() 209 | blackCoverView!.alpha = 0 210 | blackCoverView!.hidden = true 211 | } 212 | 213 | func willShowLeftViewController(){ 214 | rightSideView!.hidden = true 215 | leftSideView!.hidden = false 216 | self.view.sendSubviewToBack(rightSideView!) 217 | 218 | blackCoverView!.hidden = false 219 | } 220 | 221 | func willShowRightViewController(){ 222 | 223 | rightSideView!.hidden = false 224 | leftSideView!.hidden = true 225 | self.view.sendSubviewToBack(leftSideView!) 226 | blackCoverView!.hidden = false 227 | } 228 | 229 | 230 | func handleSingleFingerEvent(sender:UITapGestureRecognizer ){ 231 | self.hideSideViewController(true) 232 | } 233 | 234 | func blackCoverGesture(sender: UIPanGestureRecognizer){ 235 | if blackCoverPan!.state == UIGestureRecognizerState.Began { 236 | 237 | 238 | }else if blackCoverPan!.state == UIGestureRecognizerState.Ended { 239 | 240 | 241 | } 242 | } 243 | 244 | func moveViewWithGesture(sender: UIPanGestureRecognizer) 245 | { 246 | if menuDirection != MenuDirection.middleMenu { 247 | return 248 | } 249 | 250 | 251 | if isInAnimation { 252 | return 253 | } 254 | 255 | var velocity:CGPoint=movePan!.velocityInView(self.view) 256 | 257 | if ( movePan!.state == UIGestureRecognizerState.Began) { 258 | startPanPoint = mainContentView!.frame.origin 259 | if mainContentView!.frame.origin.x == 0 { 260 | self.showShadow(showBoundsShadow) 261 | } 262 | } 263 | var currentPostion = movePan!.translationInView(self.view) 264 | var xoffset:CGFloat = startPanPoint.x + currentPostion.x 265 | if xoffset > 0 { 266 | if (leftViewController != nil) { 267 | if !panLeft { 268 | panLeft = true 269 | self.willShowLeftViewController() 270 | panRight = false 271 | } 272 | panLeft = true 273 | self.willShowLeftViewController() 274 | panRight = false 275 | if bounces{ 276 | self.layoutCurrentViewWithOffset(xoffset) 277 | }else { 278 | self.layoutCurrentViewWithOffset(leftViewShowWidth < xoffset ? leftViewShowWidth : xoffset) 279 | } 280 | 281 | } 282 | 283 | 284 | }else if xoffset < 0{ 285 | if (rightViewController != nil) { 286 | if !panRight { 287 | panRight = true 288 | self.willShowRightViewController() 289 | panLeft = false 290 | } 291 | panRight = true 292 | self.willShowRightViewController() 293 | panLeft = false 294 | if bounces { 295 | self.layoutCurrentViewWithOffset(xoffset) 296 | }else{ 297 | self.layoutCurrentViewWithOffset(rightViewShowWidth < abs(xoffset) ? -rightViewShowWidth : xoffset) 298 | } 299 | } 300 | } 301 | 302 | 303 | if ( movePan!.state == UIGestureRecognizerState.Ended) { 304 | if mainContentView!.frame.origin.x == 0 { 305 | self.showShadow(false) 306 | }else { 307 | if panMovingRightOrLeft && mainContentView!.frame.origin.x > 20 { 308 | self.showLeftViewController(true) 309 | }else if !panMovingRightOrLeft && mainContentView!.frame.origin.x < -20 { 310 | self.showRightViewController(true) 311 | }else { 312 | self.hideSideViewController(true) 313 | } 314 | } 315 | }else{ 316 | if velocity.x > 0{ 317 | panMovingRightOrLeft = true 318 | }else if velocity.x < 0 { 319 | panMovingRightOrLeft = false 320 | } 321 | } 322 | } 323 | 324 | func showLeftViewController(animated:Bool){ 325 | if (leftViewController == nil) { 326 | return; 327 | } 328 | menuDirection = MenuDirection.leftMenu 329 | self.willShowLeftViewController() 330 | var animatedTime:NSTimeInterval = 0 331 | if (animated) { 332 | animatedTime = Double(abs(leftViewShowWidth - mainContentView!.frame.origin.x) / leftViewShowWidth * directionAnimationDuration) 333 | 334 | } 335 | blackTapPan!.enabled = true 336 | blackCoverPan!.enabled = true 337 | isInAnimation = true 338 | self.showAnimationEffects(animatedTime, ShowWidth: self.leftViewShowWidth,{ (finish:Bool) -> Void in 339 | self.isInAnimation = false 340 | }) 341 | } 342 | 343 | func showAnimationEffects(animatedTime:NSTimeInterval,ShowWidth:CGFloat, pletion:(finish:Bool)->Void){ 344 | isInAnimation = true 345 | var Version:NSString = UIDevice.currentDevice().systemVersion 346 | if springBack && Version.floatValue >= 7.0 && ShowWidth != 0{ 347 | UIView.animateWithDuration(animatedTime , delay: 0, usingSpringWithDamping: CGFloat( springBackDuration) , initialSpringVelocity: SpringVelocity, options: UIViewAnimationOptions.AllowUserInteraction, animations: { 348 | self.layoutCurrentViewWithOffset(ShowWidth) 349 | }, completion: { 350 | (finish:Bool) -> Void in 351 | self.isInAnimation = false 352 | pletion(finish: finish) 353 | }) 354 | 355 | }else { 356 | UIView.setAnimationCurve(UIViewAnimationCurve.EaseInOut) 357 | UIView.animateWithDuration(animatedTime, animations: { 358 | self.layoutCurrentViewWithOffset(ShowWidth) 359 | 360 | }, completion: { 361 | (finish:Bool) -> Void in 362 | 363 | if finish{ 364 | pletion(finish: finish) 365 | } 366 | }) 367 | 368 | } 369 | 370 | } 371 | 372 | func showRightViewController(animated:Bool){ 373 | if (rightViewController == nil) { 374 | return; 375 | } 376 | menuDirection = MenuDirection.rightMenu 377 | self.willShowRightViewController() 378 | var animatedTime:NSTimeInterval = 0 379 | if (animated) { 380 | animatedTime = Double(abs(rightViewShowWidth + mainContentView!.frame.origin.x) / rightViewShowWidth * directionAnimationDuration) 381 | 382 | } 383 | blackTapPan!.enabled = true 384 | blackCoverPan!.enabled = true 385 | isInAnimation = true 386 | self.showAnimationEffects(animatedTime, ShowWidth: -self.rightViewShowWidth,{ (finish:Bool) -> Void in 387 | self.isInAnimation = false 388 | }) 389 | } 390 | 391 | 392 | func hideSideViewController(animated:Bool){ 393 | self.showShadow(false) 394 | menuDirection = MenuDirection.middleMenu 395 | var animatedTime:NSTimeInterval = 0 396 | if (animated) { 397 | animatedTime = Double(abs( mainContentView!.frame.origin.x / (mainContentView!.frame.origin.x > 0 ? leftViewShowWidth : rightViewShowWidth ) * backAnimationDuration)) 398 | } 399 | isInAnimation = true 400 | self.showAnimationEffects(animatedTime, ShowWidth: 0, pletion: {(finish:Bool) -> Void in 401 | self.isInAnimation = false 402 | if finish { 403 | self.blackCoverView!.hidden = true 404 | self.blackTapPan!.enabled = false 405 | self.blackCoverPan!.enabled = false 406 | self.panLeft = false 407 | self.panRight = false 408 | self.rightSideView!.hidden = true 409 | self.leftSideView!.hidden = true 410 | } 411 | }) 412 | } 413 | 414 | 415 | func layoutCurrentViewWithOffset(xoffset:CGFloat){ 416 | 417 | if (delegate?.CustomlayoutViewWithOffset? != nil) { 418 | delegate?.CustomlayoutViewWithOffset?(xoffset,menuController: self) 419 | return 420 | } 421 | self.mainCurrentViewWithOffset(xoffset) 422 | 423 | } 424 | 425 | func mainCurrentViewWithOffset(xoffset:CGFloat){ 426 | blackCoverView!.alpha = abs(xoffset/leftViewShowWidth) * 0.5 427 | 428 | var scale:CGFloat = 0.0 429 | if xoffset > 0 { 430 | scale = 1 - abs(xoffset/(leftViewShowWidth-leftSmoothWidth)) * (1-minScale) 431 | }else if xoffset < 0 { 432 | scale = 1 - abs(xoffset/(rightViewShowWidth-rightSmoothWidth)) * (1-minScale) 433 | }else { 434 | scale = 1 435 | } 436 | scale = max(scale, minScale) 437 | mainContentView!.transform = CGAffineTransformScale(CGAffineTransformIdentity,scale,scale) 438 | var newFrame = CGRectMake(xoffset, (self.view.frame.size.height - self.view.frame.size.height * scale )/2 , self.view.frame.size.width * scale, self.view.frame.size.height * scale) 439 | 440 | println(newFrame) 441 | if xoffset > 0 { 442 | newFrame.origin.x = xoffset 443 | }else if xoffset < 0 { 444 | newFrame.origin.x = xoffset + (1.0 - scale) * self.view.frame.size.width 445 | 446 | } 447 | mainContentView!.frame = newFrame 448 | } 449 | 450 | } 451 | -------------------------------------------------------------------------------- /DrawerMenuController Controller/DrawerMenuExplain.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawerMenuExplain.swift 3 | // DrawerMenuController Controller 4 | // 5 | // Created by SunSet on 14-7-18. 6 | // Copyright (c) 2014年 zhaokaiyuan. All rights reserved. 7 | // qq 623046455 邮箱 zhaokaiyuan99@163.com 8 | 9 | import Foundation 10 | 11 | /* 12 | 13 | 默认值可以自行修改 14 | minScale:CGFloat = 0.8 //root 最小缩放 15 | leftViewShowWidth:CGFloat = 220 //左边View 长度 16 | leftSmoothWidth:CGFloat = 80 //滑动是缩放后平滑距离 17 | rightViewShowWidth:CGFloat = 220 //右边 18 | rightSmoothWidth:CGFloat = 80 19 | directionAnimationDuration:CGFloat = 0.8 //左右滑动动画时间 20 | backAnimationDuration:CGFloat = 0.35 //返回动画时间 21 | bounces:Bool = true //滑动边界回弹 22 | springBack:Bool = true //是否支持回弹效果 object—c 只有ios7 以上有效 swift ios7以下未知 没有测试过 23 | springBackDuration:CGFloat = 0.5 //回弹时间 24 | SpringVelocity:CGFloat = 0.5 25 | blackCoverView!.backgroundColor //蒙版颜色 26 | //左滑 27 | showLeftViewController(animated: Bool) 28 | //右滑 29 | showRightViewController(animated: Bool) 30 | //返回中间 31 | hideSideViewController(animated: Bool) 32 | 33 | 如果自定义实现效果 可以滑动时修改 34 | leftSideView mainContentView rightSideView 左中右3个view 35 | 写出自己想要的动画 36 | //参考 CustomMenuController 继承后在改效果 37 | //或者 设置DrawerMenuControllerDelegate 38 | //在CustomlayoutViewWithOffset重写效果 39 | 40 | 41 | */ -------------------------------------------------------------------------------- /DrawerMenuController Controller/FirstViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawerMenuExplain.swift 3 | // DrawerMenuController Controller 4 | // 5 | // Created by SunSet on 14-7-18. 6 | // Copyright (c) 2014年 zhaokaiyuan. All rights reserved. 7 | // qq 623046455 邮箱 zhaokaiyuan99@163.com 8 | 9 | 10 | 11 | import UIKit 12 | 13 | class FirstViewController: UIViewController { 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | var image:UIImageView = UIImageView(image: UIImage(named: "1.png")) 18 | self.view.addSubview(image) 19 | image.frame = self.view.frame 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | override func didReceiveMemoryWarning() { 24 | super.didReceiveMemoryWarning() 25 | // Dispose of any resources that can be recreated. 26 | } 27 | 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /DrawerMenuController Controller/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 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /DrawerMenuController Controller/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 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /DrawerMenuController Controller/Images.xcassets/first.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "first.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "first@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /DrawerMenuController Controller/Images.xcassets/first.imageset/first.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaokaiyuan99/DrawerMenuController/d160bff58345ca00d55543dbf76b21d24bc1b828/DrawerMenuController Controller/Images.xcassets/first.imageset/first.png -------------------------------------------------------------------------------- /DrawerMenuController Controller/Images.xcassets/first.imageset/first@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaokaiyuan99/DrawerMenuController/d160bff58345ca00d55543dbf76b21d24bc1b828/DrawerMenuController Controller/Images.xcassets/first.imageset/first@2x.png -------------------------------------------------------------------------------- /DrawerMenuController Controller/Images.xcassets/second.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "second.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "second@2x.png" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /DrawerMenuController Controller/Images.xcassets/second.imageset/second.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaokaiyuan99/DrawerMenuController/d160bff58345ca00d55543dbf76b21d24bc1b828/DrawerMenuController Controller/Images.xcassets/second.imageset/second.png -------------------------------------------------------------------------------- /DrawerMenuController Controller/Images.xcassets/second.imageset/second@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaokaiyuan99/DrawerMenuController/d160bff58345ca00d55543dbf76b21d24bc1b828/DrawerMenuController Controller/Images.xcassets/second.imageset/second@2x.png -------------------------------------------------------------------------------- /DrawerMenuController Controller/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | yuan.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UIStatusBarTintParameters 30 | 31 | UINavigationBar 32 | 33 | Style 34 | UIBarStyleDefault 35 | Translucent 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /DrawerMenuController Controller/MainViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawerMenuExplain.swift 3 | // DrawerMenuController Controller 4 | // 5 | // Created by SunSet on 14-7-18. 6 | // Copyright (c) 2014年 zhaokaiyuan. All rights reserved. 7 | // qq 623046455 邮箱 zhaokaiyuan99@163.com 8 | 9 | 10 | import UIKit 11 | 12 | class MainViewController:UIViewController,DrawerMenuControllerDelegate{ 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | var leftBtn:UIButton = UIButton(frame: CGRectMake(20,0, 60, 40)) 18 | leftBtn.addTarget(self, action: "leftItemClick", forControlEvents: UIControlEvents.TouchUpInside) 19 | self.view.addSubview(leftBtn) 20 | leftBtn.setTitleColor(UIColor.redColor(), forState: UIControlState.Normal) 21 | leftBtn.setTitleColor(UIColor.whiteColor(), forState: UIControlState.Highlighted) 22 | leftBtn.setTitle("leftBtn", forState: UIControlState.Normal) 23 | leftBtn.setTitle("leftBtn", forState: UIControlState.Highlighted) 24 | 25 | 26 | var rightBtn:UIButton = UIButton(frame: CGRectMake(self.view.frame.size.width-65,0, 65, 40)) 27 | rightBtn.addTarget(self, action: "rightItemClick", forControlEvents: UIControlEvents.TouchUpInside) 28 | self.view.addSubview(rightBtn) 29 | rightBtn.setTitleColor(UIColor.redColor(), forState: UIControlState.Normal) 30 | rightBtn.setTitleColor(UIColor.whiteColor(), forState: UIControlState.Highlighted) 31 | rightBtn.setTitle("rightBtn", forState: UIControlState.Normal) 32 | rightBtn.setTitle("rightBtn", forState: UIControlState.Highlighted) 33 | 34 | 35 | 36 | 37 | var label:UILabel = UILabel(frame:CGRectMake(60,40, 200, 30)) 38 | label.text = "侧滑菜单" 39 | label.textAlignment = NSTextAlignment.Center 40 | label.font = UIFont.systemFontOfSize(16) 41 | label.backgroundColor = UIColor.clearColor() 42 | self.view.addSubview(label) 43 | 44 | 45 | var button:UIButton = UIButton(frame: CGRectMake(60,100, 200, 30)) 46 | button.addTarget(self, action: "back:", forControlEvents: UIControlEvents.TouchUpInside) 47 | self.view.addSubview(button) 48 | 49 | button.setTitleColor(UIColor.redColor(), forState: UIControlState.Normal) 50 | button.setTitleColor(UIColor.whiteColor(), forState: UIControlState.Highlighted) 51 | button.setTitle("back ", forState: UIControlState.Normal) 52 | button.setTitle("back ", forState: UIControlState.Highlighted) 53 | 54 | 55 | 56 | // Do any additional setup after loading the view, typically from a nib. 57 | } 58 | 59 | //DrawerMenuControllerDelegate 60 | func CustomlayoutViewWithOffset(xoffset: CGFloat, menuController: DrawerMenuController) { 61 | println(xoffset) 62 | menuController.mainCurrentViewWithOffset(xoffset) 63 | if xoffset > 0 { 64 | menuController.leftSideView!.frame = CGRectMake( ( -menuController.leftSideView!.frame.size.width + xoffset + xoffset / menuController.leftViewShowWidth * ( menuController.leftSideView!.frame.size.width - xoffset) ) , 0, menuController.leftSideView!.frame.size.width, menuController.leftSideView!.frame.size.height) 65 | menuController.leftSideView!.alpha = xoffset/menuController.leftViewShowWidth 66 | } 67 | } 68 | 69 | 70 | 71 | func leftItemClick(){ 72 | 73 | 74 | (UIApplication.sharedApplication().delegate as AppDelegate).menuController?.showLeftViewController(true) 75 | 76 | } 77 | 78 | func rightItemClick(){ 79 | (UIApplication.sharedApplication().delegate as AppDelegate).menuController?.showRightViewController(true) 80 | 81 | } 82 | 83 | override func didReceiveMemoryWarning() { 84 | super.didReceiveMemoryWarning() 85 | // Dispose of any resources that can be recreated. 86 | } 87 | 88 | func back(sender:UIButton){ 89 | var mainViewController = RootViewController(nibName:nil, bundle: nil) 90 | var navigationViewController = UINavigationController(rootViewController: mainViewController) 91 | 92 | (UIApplication.sharedApplication().delegate as AppDelegate).window!.rootViewController = navigationViewController 93 | 94 | } 95 | 96 | 97 | } -------------------------------------------------------------------------------- /DrawerMenuController Controller/RootController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawerMenuExplain.swift 3 | // DrawerMenuController Controller 4 | // 5 | // Created by SunSet on 14-7-18. 6 | // Copyright (c) 2014年 zhaokaiyuan. All rights reserved. 7 | // qq 623046455 邮箱 zhaokaiyuan99@163.com 8 | 9 | 10 | 11 | 12 | import UIKit 13 | 14 | class RootViewController: UITableViewController { 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | self.tableView.registerClass(UITableViewCell.classForCoder(), forCellReuseIdentifier: "TableViewCellIdentifier") 20 | 21 | 22 | // tas.assaf() 23 | // Do any additional setup after loading the view, typically from a nib. 24 | } 25 | 26 | override func didReceiveMemoryWarning() { 27 | super.didReceiveMemoryWarning() 28 | // Dispose of any resources that can be recreated. 29 | } 30 | 31 | override func tableView(tableView: (UITableView!), numberOfRowsInSection section: Int) -> Int { 32 | return 4 33 | } 34 | 35 | 36 | override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 37 | 38 | if indexPath.row == 0 { 39 | 40 | var rootController = MainViewController(nibName:nil, bundle: nil) 41 | rootController.view.backgroundColor = UIColor.whiteColor() 42 | var leftViewController = FirstViewController() 43 | leftViewController.view.backgroundColor = UIColor.brownColor() 44 | var rightViewController = SecondViewController() 45 | rightViewController.view.backgroundColor = UIColor.purpleColor() 46 | 47 | 48 | var drawerMenuController:DrawerMenuController = DrawerMenuController() 49 | drawerMenuController.rootViewController = rootController 50 | drawerMenuController.leftViewController = leftViewController 51 | drawerMenuController.rightViewController = rightViewController 52 | drawerMenuController.needSwipeShowMenu = true 53 | (UIApplication.sharedApplication().delegate as AppDelegate).menuController = drawerMenuController 54 | (UIApplication.sharedApplication().delegate as AppDelegate).window?.rootViewController = drawerMenuController; 55 | 56 | 57 | 58 | }else if indexPath.row == 1{ 59 | var rootController = MainViewController(nibName:nil, bundle: nil) 60 | rootController.view.backgroundColor = UIColor.whiteColor() 61 | var leftViewController = FirstViewController() 62 | leftViewController.view.backgroundColor = UIColor.brownColor() 63 | var rightViewController = SecondViewController() 64 | rightViewController.view.backgroundColor = UIColor.purpleColor() 65 | var drawerMenuController:DrawerMenuController = DrawerMenuController() 66 | drawerMenuController.rootViewController = rootController 67 | drawerMenuController.leftViewController = leftViewController 68 | drawerMenuController.rightViewController = rightViewController 69 | drawerMenuController.needSwipeShowMenu = true 70 | drawerMenuController.delegate = rootController 71 | (UIApplication.sharedApplication().delegate as AppDelegate).menuController = drawerMenuController 72 | 73 | (UIApplication.sharedApplication().delegate as AppDelegate).window?.rootViewController = drawerMenuController; 74 | 75 | }else if indexPath.row == 2{ 76 | var rootController = MainViewController(nibName:nil, bundle: nil) 77 | rootController.view.backgroundColor = UIColor.whiteColor() 78 | var leftViewController = FirstViewController() 79 | leftViewController.view.backgroundColor = UIColor.brownColor() 80 | var rightViewController = SecondViewController() 81 | rightViewController.view.backgroundColor = UIColor.purpleColor() 82 | var drawerMenuController:CustomMenuController = CustomMenuController() 83 | drawerMenuController.rootViewController = rootController 84 | drawerMenuController.leftViewController = leftViewController 85 | drawerMenuController.rightViewController = rightViewController 86 | drawerMenuController.needSwipeShowMenu = true 87 | drawerMenuController.delegate = rootController 88 | (UIApplication.sharedApplication().delegate as AppDelegate).menuController = drawerMenuController 89 | 90 | (UIApplication.sharedApplication().delegate as AppDelegate).window?.rootViewController = drawerMenuController; 91 | 92 | 93 | } 94 | } 95 | 96 | 97 | override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 98 | var cell: UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("Cell") as? UITableViewCell 99 | 100 | if cell == nil { // no value 101 | cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell") as UITableViewCell 102 | cell!.selectionStyle = UITableViewCellSelectionStyle.None 103 | var label = UILabel() 104 | label.frame = CGRectMake(0, 0, 320, 36) 105 | label.font = UIFont.boldSystemFontOfSize(13) 106 | label.textColor = UIColor.blackColor() 107 | label.backgroundColor = UIColor.clearColor() 108 | label.textAlignment = NSTextAlignment.Center 109 | cell!.contentView.addSubview(label) 110 | label.tag = 1000001 111 | } 112 | var label:UILabel = cell!.contentView.viewWithTag(1000001) as UILabel 113 | 114 | if indexPath.row == 0 { 115 | label.text = "DrawerMenuController" 116 | }else if indexPath.row == 1{ 117 | label.text = "CustomMenuController" 118 | } else if indexPath.row == 2{ 119 | label.text = "DrawerMenuController+自定义" 120 | }else { 121 | label.text = "DrawerMenuExplain.swift 说明" 122 | 123 | } 124 | return cell! 125 | } 126 | 127 | 128 | 129 | 130 | 131 | } 132 | -------------------------------------------------------------------------------- /DrawerMenuController Controller/SecondViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawerMenuExplain.swift 3 | // DrawerMenuController Controller 4 | // 5 | // Created by SunSet on 14-7-18. 6 | // Copyright (c) 2014年 zhaokaiyuan. All rights reserved. 7 | // qq 623046455 邮箱 zhaokaiyuan99@163.com 8 | 9 | 10 | import UIKit 11 | 12 | class SecondViewController: UIViewController { 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | // Do any additional setup after loading the view, typically from a nib. 17 | } 18 | 19 | override func didReceiveMemoryWarning() { 20 | super.didReceiveMemoryWarning() 21 | // Dispose of any resources that can be recreated. 22 | } 23 | 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /DrawerMenuController ControllerTests/DrawerMenuController_ControllerTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawerMenuController_ControllerTests.swift 3 | // DrawerMenuController ControllerTests 4 | // 5 | // Created by SunSet on 14-7-15. 6 | // Copyright (c) 2014年 zhaokaiyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class DrawerMenuController_ControllerTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /DrawerMenuController ControllerTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | yuan.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | --------------------------------------------------------------------------------