├── README.md ├── SideAnimation.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── yzy.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── SideAnimation.xcscheme │ └── xcschememanagement.plist ├── SideAnimation ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── SideView │ ├── SideMeunBtn.h │ ├── SideMeunBtn.m │ ├── SideView.h │ └── SideView.m ├── ViewController.h ├── ViewController.m └── main.m ├── SideAnimationTests ├── Info.plist └── SideAnimationTests.m ├── SideAnimationUITests ├── Info.plist └── SideAnimationUITests.m └── SideMenuAnimation.gif /README.md: -------------------------------------------------------------------------------- 1 | # SideMenuAnimation 2 | 3 | ## Introduction 4 | This is the animation of the side menu popup from the left side of the view.you can use a button or a pan gesture to show the menu like my demo. 5 | 6 | ## How to use 7 | ```object-c 8 | _sideView = [[SideView alloc] initWithTitleItems:@[@"首页",@"消息",@"推荐",@"更多",@"1",@"2",@"3"]]; 9 | _sideView.menuBtnClick = ^(NSString *title) { 10 | NSLog(@"title %@",title); 11 | }; 12 | ``` 13 | you shoule set the side menu's items,and you can set the block to do something 14 | ```object-c 15 | [_sideView trigger], 16 | ``` 17 | and then you call the trigger,that's easy! 18 | 19 | ## Gif 20 | ![](https://github.com/Yuzeyang/SideMenuAnimation/raw/master/SideMenuAnimation.gif) -------------------------------------------------------------------------------- /SideAnimation.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5B6AA1121BDB326D00C570D4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B6AA1111BDB326D00C570D4 /* main.m */; }; 11 | 5B6AA1151BDB326D00C570D4 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B6AA1141BDB326D00C570D4 /* AppDelegate.m */; }; 12 | 5B6AA1181BDB326D00C570D4 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B6AA1171BDB326D00C570D4 /* ViewController.m */; }; 13 | 5B6AA11B1BDB326D00C570D4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5B6AA1191BDB326D00C570D4 /* Main.storyboard */; }; 14 | 5B6AA11D1BDB326D00C570D4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5B6AA11C1BDB326D00C570D4 /* Assets.xcassets */; }; 15 | 5B6AA1201BDB326D00C570D4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5B6AA11E1BDB326D00C570D4 /* LaunchScreen.storyboard */; }; 16 | 5B6AA12B1BDB326E00C570D4 /* SideAnimationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B6AA12A1BDB326E00C570D4 /* SideAnimationTests.m */; }; 17 | 5B6AA1361BDB326E00C570D4 /* SideAnimationUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B6AA1351BDB326E00C570D4 /* SideAnimationUITests.m */; }; 18 | 5B8D718B1C2992D80092CFB5 /* SideMeunBtn.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B8D71881C2992D80092CFB5 /* SideMeunBtn.m */; }; 19 | 5B8D718C1C2992D80092CFB5 /* SideView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B8D718A1C2992D80092CFB5 /* SideView.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 5B6AA1271BDB326E00C570D4 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 5B6AA1051BDB326D00C570D4 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 5B6AA10C1BDB326D00C570D4; 28 | remoteInfo = SideAnimation; 29 | }; 30 | 5B6AA1321BDB326E00C570D4 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 5B6AA1051BDB326D00C570D4 /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 5B6AA10C1BDB326D00C570D4; 35 | remoteInfo = SideAnimation; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 5B6AA10D1BDB326D00C570D4 /* SideAnimation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SideAnimation.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 5B6AA1111BDB326D00C570D4 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 42 | 5B6AA1131BDB326D00C570D4 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 43 | 5B6AA1141BDB326D00C570D4 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 44 | 5B6AA1161BDB326D00C570D4 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 45 | 5B6AA1171BDB326D00C570D4 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 46 | 5B6AA11A1BDB326D00C570D4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 47 | 5B6AA11C1BDB326D00C570D4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 48 | 5B6AA11F1BDB326D00C570D4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 49 | 5B6AA1211BDB326D00C570D4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 5B6AA1261BDB326E00C570D4 /* SideAnimationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SideAnimationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 5B6AA12A1BDB326E00C570D4 /* SideAnimationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SideAnimationTests.m; sourceTree = ""; }; 52 | 5B6AA12C1BDB326E00C570D4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 5B6AA1311BDB326E00C570D4 /* SideAnimationUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SideAnimationUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 5B6AA1351BDB326E00C570D4 /* SideAnimationUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SideAnimationUITests.m; sourceTree = ""; }; 55 | 5B6AA1371BDB326E00C570D4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | 5B8D71871C2992D80092CFB5 /* SideMeunBtn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SideMeunBtn.h; sourceTree = ""; }; 57 | 5B8D71881C2992D80092CFB5 /* SideMeunBtn.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SideMeunBtn.m; sourceTree = ""; }; 58 | 5B8D71891C2992D80092CFB5 /* SideView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SideView.h; sourceTree = ""; }; 59 | 5B8D718A1C2992D80092CFB5 /* SideView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SideView.m; sourceTree = ""; }; 60 | /* End PBXFileReference section */ 61 | 62 | /* Begin PBXFrameworksBuildPhase section */ 63 | 5B6AA10A1BDB326D00C570D4 /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | 5B6AA1231BDB326E00C570D4 /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | 5B6AA12E1BDB326E00C570D4 /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | /* End PBXFrameworksBuildPhase section */ 85 | 86 | /* Begin PBXGroup section */ 87 | 5B6AA1041BDB326D00C570D4 = { 88 | isa = PBXGroup; 89 | children = ( 90 | 5B6AA10F1BDB326D00C570D4 /* SideAnimation */, 91 | 5B6AA1291BDB326E00C570D4 /* SideAnimationTests */, 92 | 5B6AA1341BDB326E00C570D4 /* SideAnimationUITests */, 93 | 5B6AA10E1BDB326D00C570D4 /* Products */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | 5B6AA10E1BDB326D00C570D4 /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 5B6AA10D1BDB326D00C570D4 /* SideAnimation.app */, 101 | 5B6AA1261BDB326E00C570D4 /* SideAnimationTests.xctest */, 102 | 5B6AA1311BDB326E00C570D4 /* SideAnimationUITests.xctest */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | 5B6AA10F1BDB326D00C570D4 /* SideAnimation */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 5B6AA1131BDB326D00C570D4 /* AppDelegate.h */, 111 | 5B6AA1141BDB326D00C570D4 /* AppDelegate.m */, 112 | 5B6AA1161BDB326D00C570D4 /* ViewController.h */, 113 | 5B6AA1171BDB326D00C570D4 /* ViewController.m */, 114 | 5B6AA1191BDB326D00C570D4 /* Main.storyboard */, 115 | 5B8D71861C2992D80092CFB5 /* SideView */, 116 | 5B6AA11C1BDB326D00C570D4 /* Assets.xcassets */, 117 | 5B6AA11E1BDB326D00C570D4 /* LaunchScreen.storyboard */, 118 | 5B6AA1211BDB326D00C570D4 /* Info.plist */, 119 | 5B6AA1101BDB326D00C570D4 /* Supporting Files */, 120 | ); 121 | path = SideAnimation; 122 | sourceTree = ""; 123 | }; 124 | 5B6AA1101BDB326D00C570D4 /* Supporting Files */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 5B6AA1111BDB326D00C570D4 /* main.m */, 128 | ); 129 | name = "Supporting Files"; 130 | sourceTree = ""; 131 | }; 132 | 5B6AA1291BDB326E00C570D4 /* SideAnimationTests */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 5B6AA12A1BDB326E00C570D4 /* SideAnimationTests.m */, 136 | 5B6AA12C1BDB326E00C570D4 /* Info.plist */, 137 | ); 138 | path = SideAnimationTests; 139 | sourceTree = ""; 140 | }; 141 | 5B6AA1341BDB326E00C570D4 /* SideAnimationUITests */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 5B6AA1351BDB326E00C570D4 /* SideAnimationUITests.m */, 145 | 5B6AA1371BDB326E00C570D4 /* Info.plist */, 146 | ); 147 | path = SideAnimationUITests; 148 | sourceTree = ""; 149 | }; 150 | 5B8D71861C2992D80092CFB5 /* SideView */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 5B8D71871C2992D80092CFB5 /* SideMeunBtn.h */, 154 | 5B8D71881C2992D80092CFB5 /* SideMeunBtn.m */, 155 | 5B8D71891C2992D80092CFB5 /* SideView.h */, 156 | 5B8D718A1C2992D80092CFB5 /* SideView.m */, 157 | ); 158 | path = SideView; 159 | sourceTree = ""; 160 | }; 161 | /* End PBXGroup section */ 162 | 163 | /* Begin PBXNativeTarget section */ 164 | 5B6AA10C1BDB326D00C570D4 /* SideAnimation */ = { 165 | isa = PBXNativeTarget; 166 | buildConfigurationList = 5B6AA13A1BDB326E00C570D4 /* Build configuration list for PBXNativeTarget "SideAnimation" */; 167 | buildPhases = ( 168 | 5B6AA1091BDB326D00C570D4 /* Sources */, 169 | 5B6AA10A1BDB326D00C570D4 /* Frameworks */, 170 | 5B6AA10B1BDB326D00C570D4 /* Resources */, 171 | ); 172 | buildRules = ( 173 | ); 174 | dependencies = ( 175 | ); 176 | name = SideAnimation; 177 | productName = SideAnimation; 178 | productReference = 5B6AA10D1BDB326D00C570D4 /* SideAnimation.app */; 179 | productType = "com.apple.product-type.application"; 180 | }; 181 | 5B6AA1251BDB326E00C570D4 /* SideAnimationTests */ = { 182 | isa = PBXNativeTarget; 183 | buildConfigurationList = 5B6AA13D1BDB326E00C570D4 /* Build configuration list for PBXNativeTarget "SideAnimationTests" */; 184 | buildPhases = ( 185 | 5B6AA1221BDB326E00C570D4 /* Sources */, 186 | 5B6AA1231BDB326E00C570D4 /* Frameworks */, 187 | 5B6AA1241BDB326E00C570D4 /* Resources */, 188 | ); 189 | buildRules = ( 190 | ); 191 | dependencies = ( 192 | 5B6AA1281BDB326E00C570D4 /* PBXTargetDependency */, 193 | ); 194 | name = SideAnimationTests; 195 | productName = SideAnimationTests; 196 | productReference = 5B6AA1261BDB326E00C570D4 /* SideAnimationTests.xctest */; 197 | productType = "com.apple.product-type.bundle.unit-test"; 198 | }; 199 | 5B6AA1301BDB326E00C570D4 /* SideAnimationUITests */ = { 200 | isa = PBXNativeTarget; 201 | buildConfigurationList = 5B6AA1401BDB326E00C570D4 /* Build configuration list for PBXNativeTarget "SideAnimationUITests" */; 202 | buildPhases = ( 203 | 5B6AA12D1BDB326E00C570D4 /* Sources */, 204 | 5B6AA12E1BDB326E00C570D4 /* Frameworks */, 205 | 5B6AA12F1BDB326E00C570D4 /* Resources */, 206 | ); 207 | buildRules = ( 208 | ); 209 | dependencies = ( 210 | 5B6AA1331BDB326E00C570D4 /* PBXTargetDependency */, 211 | ); 212 | name = SideAnimationUITests; 213 | productName = SideAnimationUITests; 214 | productReference = 5B6AA1311BDB326E00C570D4 /* SideAnimationUITests.xctest */; 215 | productType = "com.apple.product-type.bundle.ui-testing"; 216 | }; 217 | /* End PBXNativeTarget section */ 218 | 219 | /* Begin PBXProject section */ 220 | 5B6AA1051BDB326D00C570D4 /* Project object */ = { 221 | isa = PBXProject; 222 | attributes = { 223 | LastUpgradeCheck = 0710; 224 | ORGANIZATIONNAME = "宫城"; 225 | TargetAttributes = { 226 | 5B6AA10C1BDB326D00C570D4 = { 227 | CreatedOnToolsVersion = 7.1; 228 | }; 229 | 5B6AA1251BDB326E00C570D4 = { 230 | CreatedOnToolsVersion = 7.1; 231 | TestTargetID = 5B6AA10C1BDB326D00C570D4; 232 | }; 233 | 5B6AA1301BDB326E00C570D4 = { 234 | CreatedOnToolsVersion = 7.1; 235 | TestTargetID = 5B6AA10C1BDB326D00C570D4; 236 | }; 237 | }; 238 | }; 239 | buildConfigurationList = 5B6AA1081BDB326D00C570D4 /* Build configuration list for PBXProject "SideAnimation" */; 240 | compatibilityVersion = "Xcode 3.2"; 241 | developmentRegion = English; 242 | hasScannedForEncodings = 0; 243 | knownRegions = ( 244 | en, 245 | Base, 246 | ); 247 | mainGroup = 5B6AA1041BDB326D00C570D4; 248 | productRefGroup = 5B6AA10E1BDB326D00C570D4 /* Products */; 249 | projectDirPath = ""; 250 | projectRoot = ""; 251 | targets = ( 252 | 5B6AA10C1BDB326D00C570D4 /* SideAnimation */, 253 | 5B6AA1251BDB326E00C570D4 /* SideAnimationTests */, 254 | 5B6AA1301BDB326E00C570D4 /* SideAnimationUITests */, 255 | ); 256 | }; 257 | /* End PBXProject section */ 258 | 259 | /* Begin PBXResourcesBuildPhase section */ 260 | 5B6AA10B1BDB326D00C570D4 /* Resources */ = { 261 | isa = PBXResourcesBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | 5B6AA1201BDB326D00C570D4 /* LaunchScreen.storyboard in Resources */, 265 | 5B6AA11D1BDB326D00C570D4 /* Assets.xcassets in Resources */, 266 | 5B6AA11B1BDB326D00C570D4 /* Main.storyboard in Resources */, 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | }; 270 | 5B6AA1241BDB326E00C570D4 /* Resources */ = { 271 | isa = PBXResourcesBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | ); 275 | runOnlyForDeploymentPostprocessing = 0; 276 | }; 277 | 5B6AA12F1BDB326E00C570D4 /* Resources */ = { 278 | isa = PBXResourcesBuildPhase; 279 | buildActionMask = 2147483647; 280 | files = ( 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | }; 284 | /* End PBXResourcesBuildPhase section */ 285 | 286 | /* Begin PBXSourcesBuildPhase section */ 287 | 5B6AA1091BDB326D00C570D4 /* Sources */ = { 288 | isa = PBXSourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | 5B6AA1181BDB326D00C570D4 /* ViewController.m in Sources */, 292 | 5B6AA1151BDB326D00C570D4 /* AppDelegate.m in Sources */, 293 | 5B8D718C1C2992D80092CFB5 /* SideView.m in Sources */, 294 | 5B8D718B1C2992D80092CFB5 /* SideMeunBtn.m in Sources */, 295 | 5B6AA1121BDB326D00C570D4 /* main.m in Sources */, 296 | ); 297 | runOnlyForDeploymentPostprocessing = 0; 298 | }; 299 | 5B6AA1221BDB326E00C570D4 /* Sources */ = { 300 | isa = PBXSourcesBuildPhase; 301 | buildActionMask = 2147483647; 302 | files = ( 303 | 5B6AA12B1BDB326E00C570D4 /* SideAnimationTests.m in Sources */, 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | }; 307 | 5B6AA12D1BDB326E00C570D4 /* Sources */ = { 308 | isa = PBXSourcesBuildPhase; 309 | buildActionMask = 2147483647; 310 | files = ( 311 | 5B6AA1361BDB326E00C570D4 /* SideAnimationUITests.m in Sources */, 312 | ); 313 | runOnlyForDeploymentPostprocessing = 0; 314 | }; 315 | /* End PBXSourcesBuildPhase section */ 316 | 317 | /* Begin PBXTargetDependency section */ 318 | 5B6AA1281BDB326E00C570D4 /* PBXTargetDependency */ = { 319 | isa = PBXTargetDependency; 320 | target = 5B6AA10C1BDB326D00C570D4 /* SideAnimation */; 321 | targetProxy = 5B6AA1271BDB326E00C570D4 /* PBXContainerItemProxy */; 322 | }; 323 | 5B6AA1331BDB326E00C570D4 /* PBXTargetDependency */ = { 324 | isa = PBXTargetDependency; 325 | target = 5B6AA10C1BDB326D00C570D4 /* SideAnimation */; 326 | targetProxy = 5B6AA1321BDB326E00C570D4 /* PBXContainerItemProxy */; 327 | }; 328 | /* End PBXTargetDependency section */ 329 | 330 | /* Begin PBXVariantGroup section */ 331 | 5B6AA1191BDB326D00C570D4 /* Main.storyboard */ = { 332 | isa = PBXVariantGroup; 333 | children = ( 334 | 5B6AA11A1BDB326D00C570D4 /* Base */, 335 | ); 336 | name = Main.storyboard; 337 | sourceTree = ""; 338 | }; 339 | 5B6AA11E1BDB326D00C570D4 /* LaunchScreen.storyboard */ = { 340 | isa = PBXVariantGroup; 341 | children = ( 342 | 5B6AA11F1BDB326D00C570D4 /* Base */, 343 | ); 344 | name = LaunchScreen.storyboard; 345 | sourceTree = ""; 346 | }; 347 | /* End PBXVariantGroup section */ 348 | 349 | /* Begin XCBuildConfiguration section */ 350 | 5B6AA1381BDB326E00C570D4 /* Debug */ = { 351 | isa = XCBuildConfiguration; 352 | buildSettings = { 353 | ALWAYS_SEARCH_USER_PATHS = NO; 354 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 355 | CLANG_CXX_LIBRARY = "libc++"; 356 | CLANG_ENABLE_MODULES = YES; 357 | CLANG_ENABLE_OBJC_ARC = YES; 358 | CLANG_WARN_BOOL_CONVERSION = YES; 359 | CLANG_WARN_CONSTANT_CONVERSION = YES; 360 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 361 | CLANG_WARN_EMPTY_BODY = YES; 362 | CLANG_WARN_ENUM_CONVERSION = YES; 363 | CLANG_WARN_INT_CONVERSION = YES; 364 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 365 | CLANG_WARN_UNREACHABLE_CODE = YES; 366 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 367 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 368 | COPY_PHASE_STRIP = NO; 369 | DEBUG_INFORMATION_FORMAT = dwarf; 370 | ENABLE_STRICT_OBJC_MSGSEND = YES; 371 | ENABLE_TESTABILITY = YES; 372 | GCC_C_LANGUAGE_STANDARD = gnu99; 373 | GCC_DYNAMIC_NO_PIC = NO; 374 | GCC_NO_COMMON_BLOCKS = YES; 375 | GCC_OPTIMIZATION_LEVEL = 0; 376 | GCC_PREPROCESSOR_DEFINITIONS = ( 377 | "DEBUG=1", 378 | "$(inherited)", 379 | ); 380 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 381 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 382 | GCC_WARN_UNDECLARED_SELECTOR = YES; 383 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 384 | GCC_WARN_UNUSED_FUNCTION = YES; 385 | GCC_WARN_UNUSED_VARIABLE = YES; 386 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 387 | MTL_ENABLE_DEBUG_INFO = YES; 388 | ONLY_ACTIVE_ARCH = YES; 389 | SDKROOT = iphoneos; 390 | TARGETED_DEVICE_FAMILY = "1,2"; 391 | }; 392 | name = Debug; 393 | }; 394 | 5B6AA1391BDB326E00C570D4 /* Release */ = { 395 | isa = XCBuildConfiguration; 396 | buildSettings = { 397 | ALWAYS_SEARCH_USER_PATHS = NO; 398 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 399 | CLANG_CXX_LIBRARY = "libc++"; 400 | CLANG_ENABLE_MODULES = YES; 401 | CLANG_ENABLE_OBJC_ARC = YES; 402 | CLANG_WARN_BOOL_CONVERSION = YES; 403 | CLANG_WARN_CONSTANT_CONVERSION = YES; 404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 405 | CLANG_WARN_EMPTY_BODY = YES; 406 | CLANG_WARN_ENUM_CONVERSION = YES; 407 | CLANG_WARN_INT_CONVERSION = YES; 408 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 409 | CLANG_WARN_UNREACHABLE_CODE = YES; 410 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 411 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 412 | COPY_PHASE_STRIP = NO; 413 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 414 | ENABLE_NS_ASSERTIONS = NO; 415 | ENABLE_STRICT_OBJC_MSGSEND = YES; 416 | GCC_C_LANGUAGE_STANDARD = gnu99; 417 | GCC_NO_COMMON_BLOCKS = YES; 418 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 419 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 420 | GCC_WARN_UNDECLARED_SELECTOR = YES; 421 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 422 | GCC_WARN_UNUSED_FUNCTION = YES; 423 | GCC_WARN_UNUSED_VARIABLE = YES; 424 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 425 | MTL_ENABLE_DEBUG_INFO = NO; 426 | SDKROOT = iphoneos; 427 | TARGETED_DEVICE_FAMILY = "1,2"; 428 | VALIDATE_PRODUCT = YES; 429 | }; 430 | name = Release; 431 | }; 432 | 5B6AA13B1BDB326E00C570D4 /* Debug */ = { 433 | isa = XCBuildConfiguration; 434 | buildSettings = { 435 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 436 | INFOPLIST_FILE = SideAnimation/Info.plist; 437 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 438 | PRODUCT_BUNDLE_IDENTIFIER = com.gongcheng.SideAnimation; 439 | PRODUCT_NAME = "$(TARGET_NAME)"; 440 | }; 441 | name = Debug; 442 | }; 443 | 5B6AA13C1BDB326E00C570D4 /* Release */ = { 444 | isa = XCBuildConfiguration; 445 | buildSettings = { 446 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 447 | INFOPLIST_FILE = SideAnimation/Info.plist; 448 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 449 | PRODUCT_BUNDLE_IDENTIFIER = com.gongcheng.SideAnimation; 450 | PRODUCT_NAME = "$(TARGET_NAME)"; 451 | }; 452 | name = Release; 453 | }; 454 | 5B6AA13E1BDB326E00C570D4 /* Debug */ = { 455 | isa = XCBuildConfiguration; 456 | buildSettings = { 457 | BUNDLE_LOADER = "$(TEST_HOST)"; 458 | INFOPLIST_FILE = SideAnimationTests/Info.plist; 459 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 460 | PRODUCT_BUNDLE_IDENTIFIER = com.gongcheng.SideAnimationTests; 461 | PRODUCT_NAME = "$(TARGET_NAME)"; 462 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SideAnimation.app/SideAnimation"; 463 | }; 464 | name = Debug; 465 | }; 466 | 5B6AA13F1BDB326E00C570D4 /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | buildSettings = { 469 | BUNDLE_LOADER = "$(TEST_HOST)"; 470 | INFOPLIST_FILE = SideAnimationTests/Info.plist; 471 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 472 | PRODUCT_BUNDLE_IDENTIFIER = com.gongcheng.SideAnimationTests; 473 | PRODUCT_NAME = "$(TARGET_NAME)"; 474 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SideAnimation.app/SideAnimation"; 475 | }; 476 | name = Release; 477 | }; 478 | 5B6AA1411BDB326E00C570D4 /* Debug */ = { 479 | isa = XCBuildConfiguration; 480 | buildSettings = { 481 | INFOPLIST_FILE = SideAnimationUITests/Info.plist; 482 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 483 | PRODUCT_BUNDLE_IDENTIFIER = com.gongcheng.SideAnimationUITests; 484 | PRODUCT_NAME = "$(TARGET_NAME)"; 485 | TEST_TARGET_NAME = SideAnimation; 486 | USES_XCTRUNNER = YES; 487 | }; 488 | name = Debug; 489 | }; 490 | 5B6AA1421BDB326E00C570D4 /* Release */ = { 491 | isa = XCBuildConfiguration; 492 | buildSettings = { 493 | INFOPLIST_FILE = SideAnimationUITests/Info.plist; 494 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 495 | PRODUCT_BUNDLE_IDENTIFIER = com.gongcheng.SideAnimationUITests; 496 | PRODUCT_NAME = "$(TARGET_NAME)"; 497 | TEST_TARGET_NAME = SideAnimation; 498 | USES_XCTRUNNER = YES; 499 | }; 500 | name = Release; 501 | }; 502 | /* End XCBuildConfiguration section */ 503 | 504 | /* Begin XCConfigurationList section */ 505 | 5B6AA1081BDB326D00C570D4 /* Build configuration list for PBXProject "SideAnimation" */ = { 506 | isa = XCConfigurationList; 507 | buildConfigurations = ( 508 | 5B6AA1381BDB326E00C570D4 /* Debug */, 509 | 5B6AA1391BDB326E00C570D4 /* Release */, 510 | ); 511 | defaultConfigurationIsVisible = 0; 512 | defaultConfigurationName = Release; 513 | }; 514 | 5B6AA13A1BDB326E00C570D4 /* Build configuration list for PBXNativeTarget "SideAnimation" */ = { 515 | isa = XCConfigurationList; 516 | buildConfigurations = ( 517 | 5B6AA13B1BDB326E00C570D4 /* Debug */, 518 | 5B6AA13C1BDB326E00C570D4 /* Release */, 519 | ); 520 | defaultConfigurationIsVisible = 0; 521 | defaultConfigurationName = Release; 522 | }; 523 | 5B6AA13D1BDB326E00C570D4 /* Build configuration list for PBXNativeTarget "SideAnimationTests" */ = { 524 | isa = XCConfigurationList; 525 | buildConfigurations = ( 526 | 5B6AA13E1BDB326E00C570D4 /* Debug */, 527 | 5B6AA13F1BDB326E00C570D4 /* Release */, 528 | ); 529 | defaultConfigurationIsVisible = 0; 530 | defaultConfigurationName = Release; 531 | }; 532 | 5B6AA1401BDB326E00C570D4 /* Build configuration list for PBXNativeTarget "SideAnimationUITests" */ = { 533 | isa = XCConfigurationList; 534 | buildConfigurations = ( 535 | 5B6AA1411BDB326E00C570D4 /* Debug */, 536 | 5B6AA1421BDB326E00C570D4 /* Release */, 537 | ); 538 | defaultConfigurationIsVisible = 0; 539 | defaultConfigurationName = Release; 540 | }; 541 | /* End XCConfigurationList section */ 542 | }; 543 | rootObject = 5B6AA1051BDB326D00C570D4 /* Project object */; 544 | } 545 | -------------------------------------------------------------------------------- /SideAnimation.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SideAnimation.xcodeproj/xcuserdata/yzy.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /SideAnimation.xcodeproj/xcuserdata/yzy.xcuserdatad/xcschemes/SideAnimation.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /SideAnimation.xcodeproj/xcuserdata/yzy.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SideAnimation.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 5B6AA10C1BDB326D00C570D4 16 | 17 | primary 18 | 19 | 20 | 5B6AA1251BDB326E00C570D4 21 | 22 | primary 23 | 24 | 25 | 5B6AA1301BDB326E00C570D4 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /SideAnimation/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SideAnimation 4 | // 5 | // Created by 宫城 on 15/10/24. 6 | // Copyright © 2015年 宫城. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /SideAnimation/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SideAnimation 4 | // 5 | // Created by 宫城 on 15/10/24. 6 | // Copyright © 2015年 宫城. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | // Override point for customization after application launch. 21 | ViewController *vc = [[ViewController alloc] init]; 22 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; 23 | self.window.rootViewController = nav; 24 | 25 | return YES; 26 | } 27 | 28 | - (void)applicationWillResignActive:(UIApplication *)application { 29 | // 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. 30 | // 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. 31 | } 32 | 33 | - (void)applicationDidEnterBackground:(UIApplication *)application { 34 | // 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. 35 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 36 | } 37 | 38 | - (void)applicationWillEnterForeground:(UIApplication *)application { 39 | // 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. 40 | } 41 | 42 | - (void)applicationDidBecomeActive:(UIApplication *)application { 43 | // 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. 44 | } 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /SideAnimation/Assets.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" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /SideAnimation/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SideAnimation/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /SideAnimation/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /SideAnimation/SideView/SideMeunBtn.h: -------------------------------------------------------------------------------- 1 | // 2 | // SideMeunBtn.h 3 | // SideAnimation 4 | // 5 | // Created by 宫城 on 15/10/25. 6 | // Copyright © 2015年 宫城. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SideMeunBtn : UIView 12 | 13 | @property (nonatomic, copy) void(^BtnClickBlock)(void); 14 | 15 | - (instancetype)initWithTitle:(NSString *)title; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /SideAnimation/SideView/SideMeunBtn.m: -------------------------------------------------------------------------------- 1 | // 2 | // SideMeunBtn.m 3 | // SideAnimation 4 | // 5 | // Created by 宫城 on 15/10/25. 6 | // Copyright © 2015年 宫城. All rights reserved. 7 | // 8 | 9 | #import "SideMeunBtn.h" 10 | 11 | @interface SideMeunBtn () 12 | 13 | @property (nonatomic, strong) NSString *buttonTitle; 14 | 15 | @end 16 | 17 | @implementation SideMeunBtn 18 | 19 | // Only override drawRect: if you perform custom drawing. 20 | // An empty implementation adversely affects performance during animation. 21 | - (void)drawRect:(CGRect)rect { 22 | // Drawing code 23 | CGContextRef ctx = UIGraphicsGetCurrentContext(); 24 | CGContextAddRect(ctx, rect); 25 | [[UIColor orangeColor] set]; 26 | CGContextFillPath(ctx); 27 | 28 | UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectInset(rect, 1, 1) cornerRadius:rect.size.height/2]; 29 | [[UIColor orangeColor] setFill]; 30 | [path fill]; 31 | [[UIColor whiteColor] setStroke]; 32 | path.lineWidth = 1; 33 | [path stroke]; 34 | 35 | NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init]; 36 | paragraph.alignment = NSTextAlignmentCenter; 37 | 38 | NSDictionary *attri = @{NSFontAttributeName: [UIFont systemFontOfSize:14], 39 | NSForegroundColorAttributeName: [UIColor whiteColor], 40 | NSParagraphStyleAttributeName: paragraph}; 41 | CGSize titleSize = [_buttonTitle sizeWithAttributes:attri]; 42 | CGRect titleRect = CGRectMake((rect.size.width - titleSize.width)/2 , (rect.size.height - titleSize.height)/2, titleSize.width, titleSize.height); 43 | 44 | [self.buttonTitle drawInRect:titleRect withAttributes:attri]; 45 | } 46 | 47 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { 48 | UITouch *touch = [touches anyObject]; 49 | NSInteger num = touch.tapCount; 50 | 51 | switch (num) { 52 | case 1: 53 | if (self.BtnClickBlock) { 54 | self.BtnClickBlock(); 55 | } 56 | break; 57 | 58 | default: 59 | break; 60 | } 61 | } 62 | 63 | - (instancetype)initWithTitle:(NSString *)title { 64 | self = [super init]; 65 | if (self) { 66 | _buttonTitle = title; 67 | } 68 | return self; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /SideAnimation/SideView/SideView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SideView.h 3 | // SideAnimation 4 | // 5 | // Created by 宫城 on 15/10/25. 6 | // Copyright © 2015年 宫城. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SideView : UIView 12 | 13 | @property (nonatomic, copy) void(^menuBtnClick)(NSString *title); 14 | 15 | - (id)initWithTitleItems:(NSArray *)items; 16 | 17 | - (void)trigger; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /SideAnimation/SideView/SideView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SideView.m 3 | // SideAnimation 4 | // 5 | // Created by 宫城 on 15/10/25. 6 | // Copyright © 2015年 宫城. All rights reserved. 7 | // 8 | 9 | #import "SideView.h" 10 | #import "SideMeunBtn.h" 11 | 12 | #define kExtern 30 13 | #define kBtnHeight 40 14 | #define kBtnWidth 100 15 | #define kBtnSpacing 30 16 | 17 | @interface SideView () 18 | 19 | @property (nonatomic, strong) UIView *helperSideView; 20 | @property (nonatomic, strong) UIView *helperCenterView; 21 | @property (nonatomic, strong) UIVisualEffectView *blurView; 22 | @property (nonatomic, strong) UIWindow *keyWindow; 23 | @property (nonatomic, assign) BOOL isTrigger; 24 | @property (nonatomic, strong) CADisplayLink *displayLink; 25 | @property (nonatomic, assign) NSInteger displayCount; 26 | @property (nonatomic, assign) CGFloat diff; 27 | 28 | @end 29 | 30 | @implementation SideView 31 | 32 | - (void)drawRect:(CGRect)rect { 33 | UIBezierPath *bezierPath = [UIBezierPath bezierPath]; 34 | [bezierPath moveToPoint:CGPointZero]; 35 | [bezierPath addLineToPoint:CGPointMake(self.frame.size.width - kExtern, 0)]; 36 | [bezierPath addQuadCurveToPoint:CGPointMake(self.frame.size.width - kExtern, self.frame.size.height) controlPoint:CGPointMake(_keyWindow.frame.size.width/2 + _diff, _keyWindow.frame.size.height/2)]; 37 | [bezierPath addLineToPoint:CGPointMake(0, self.frame.size.height)]; 38 | [bezierPath closePath]; 39 | 40 | CGContextRef ctx = UIGraphicsGetCurrentContext(); 41 | CGContextAddPath(ctx, bezierPath.CGPath); 42 | [[UIColor orangeColor] set]; 43 | CGContextFillPath(ctx); 44 | } 45 | 46 | - (id)initWithTitleItems:(NSArray *)items { 47 | self = [super init]; 48 | if (self) { 49 | _keyWindow = [UIApplication sharedApplication].keyWindow; 50 | _keyWindow.backgroundColor = [UIColor clearColor]; 51 | 52 | _blurView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]]; 53 | _blurView.frame = _keyWindow.frame; 54 | _blurView.alpha = 0; 55 | 56 | _helperSideView = [[UIView alloc] initWithFrame:CGRectMake(-40, 0, 40, 40)]; 57 | [_helperSideView setBackgroundColor:[UIColor redColor]]; 58 | _helperSideView.hidden = YES; 59 | [_keyWindow addSubview:_helperSideView]; 60 | 61 | _helperCenterView = [[UIView alloc] initWithFrame:CGRectMake(-40, _keyWindow.frame.size.height/2, 40, 40)]; 62 | [_helperCenterView setBackgroundColor:[UIColor yellowColor]]; 63 | _helperCenterView.hidden = YES; 64 | [_keyWindow addSubview:_helperCenterView]; 65 | 66 | [self setFrame:CGRectMake(-(CGRectGetWidth(_keyWindow.frame)/2 + kExtern), 0, CGRectGetWidth(_keyWindow.frame)/2 + kExtern, CGRectGetHeight(_keyWindow.frame))]; 67 | self.backgroundColor = [UIColor clearColor]; 68 | [_keyWindow insertSubview:self belowSubview:_helperSideView]; 69 | 70 | [self addBtns:items]; 71 | } 72 | return self; 73 | } 74 | 75 | - (void)trigger { 76 | if (!_isTrigger) { 77 | [_keyWindow insertSubview:_blurView belowSubview:self]; 78 | [UIView animateWithDuration:0.3 animations:^{ 79 | self.frame = self.bounds; 80 | }]; 81 | [self beforeAnimation]; 82 | [UIView animateWithDuration:0.7 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:0.9 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction animations:^{ 83 | [_helperSideView setCenter:CGPointMake(_keyWindow.center.x, _helperSideView.frame.size.height/2)]; 84 | } completion:^(BOOL finished) { 85 | [self endAnimation]; 86 | }]; 87 | [UIView animateWithDuration:0.3 animations:^{ 88 | _blurView.alpha = 1; 89 | }]; 90 | [self beforeAnimation]; 91 | [UIView animateWithDuration:0.7 delay:0 usingSpringWithDamping:0.8 initialSpringVelocity:2.0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction animations:^{ 92 | [_helperCenterView setCenter:_keyWindow.center]; 93 | } completion:^(BOOL finished) { 94 | if (finished) { 95 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapOnBlurView:)]; 96 | [_blurView addGestureRecognizer:tap]; 97 | } 98 | [self endAnimation]; 99 | }]; 100 | 101 | [self animationButtons]; 102 | _isTrigger = YES; 103 | } 104 | } 105 | 106 | - (void)beforeAnimation { 107 | if (!_displayLink) { 108 | _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(displayLineAction:)]; 109 | [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; 110 | } 111 | _displayCount++; 112 | } 113 | 114 | - (void)endAnimation { 115 | _displayCount--; 116 | if (_displayCount == 0) { 117 | [_displayLink invalidate]; 118 | _displayLink = nil; 119 | } 120 | } 121 | 122 | - (void)displayLineAction:(CADisplayLink *)dis { 123 | CALayer *helperSideViewPresentationLayer = (CALayer *)[_helperSideView.layer presentationLayer]; 124 | CALayer *helperCenterViewPresentationLayer = (CALayer *)[_helperCenterView.layer presentationLayer]; 125 | 126 | CGRect helperSideViewFrame = [[helperSideViewPresentationLayer valueForKeyPath:@"frame"] CGRectValue]; 127 | CGRect helperCenterViewFrame = [[helperCenterViewPresentationLayer valueForKeyPath:@"frame"] CGRectValue]; 128 | 129 | _diff = helperSideViewFrame.origin.x - helperCenterViewFrame.origin.x; 130 | // NSLog(@"%f",_diff); 131 | [self setNeedsDisplay]; 132 | } 133 | 134 | - (void)tapOnBlurView:(UITapGestureRecognizer *)gesture { 135 | [UIView animateWithDuration:0.3 animations:^{ 136 | [self setFrame:CGRectMake(-(CGRectGetWidth(_keyWindow.frame)/2 + kExtern), 0, CGRectGetWidth(_keyWindow.frame)/2 + kExtern, CGRectGetHeight(_keyWindow.frame))]; 137 | }]; 138 | [self beforeAnimation]; 139 | [UIView animateWithDuration:0.7 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:0.9 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction animations:^{ 140 | [_helperSideView setCenter:CGPointMake(-CGRectGetHeight(_helperSideView.frame)/2, CGRectGetHeight(_helperSideView.frame)/2)]; 141 | } completion:^(BOOL finished) { 142 | [self endAnimation]; 143 | }]; 144 | [UIView animateWithDuration:0.3 animations:^{ 145 | _blurView.alpha = 0; 146 | }]; 147 | [self beforeAnimation]; 148 | [UIView animateWithDuration:0.7 delay:0 usingSpringWithDamping:0.8 initialSpringVelocity:2.0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction animations:^{ 149 | [_helperCenterView setCenter:CGPointMake(-CGRectGetHeight(_helperCenterView.frame)/2, CGRectGetHeight(_keyWindow.frame)/2)]; 150 | } completion:^(BOOL finished) { 151 | [self endAnimation]; 152 | }]; 153 | 154 | _isTrigger = NO; 155 | } 156 | 157 | - (void)animationButtons { 158 | for (NSInteger i = 0; i < self.subviews.count; i++) { 159 | UIView *btn = self.subviews[i]; 160 | btn.transform = CGAffineTransformMakeTranslation(-90, 0); 161 | 162 | [UIView animateWithDuration:0.7 delay:(0.3/self.subviews.count)*i usingSpringWithDamping:0.6 initialSpringVelocity:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction animations:^{ 163 | btn.transform = CGAffineTransformIdentity; 164 | } completion:nil]; 165 | } 166 | } 167 | 168 | - (void)addBtns:(NSArray *)titleItems { 169 | // 针对奇偶数显示不同 170 | if (titleItems.count % 2) { 171 | NSInteger midNum = (titleItems.count + 1)/2 - 1; 172 | for (NSInteger i = 0; i < titleItems.count; i++) { 173 | SideMeunBtn *btn = [[SideMeunBtn alloc] initWithTitle:titleItems[i]]; 174 | [btn setFrame:CGRectMake(0, 0, kBtnWidth, kBtnHeight)]; 175 | CGFloat centerY = _blurView.center.y + (kBtnHeight + kBtnSpacing)*(i - midNum) ; 176 | [btn setCenter:CGPointMake(_keyWindow.frame.size.width/4, centerY)]; 177 | [self addSubview:btn]; 178 | 179 | __weak typeof(self)weakSelf = self; 180 | btn.BtnClickBlock = ^() { 181 | [weakSelf tapOnBlurView:nil]; 182 | if (weakSelf.menuBtnClick) { 183 | weakSelf.menuBtnClick(titleItems[i]); 184 | } 185 | }; 186 | } 187 | }else { 188 | double midNum = (double)titleItems.count/2 - 0.5; 189 | for (NSInteger i = 0; i < titleItems.count; i++) { 190 | SideMeunBtn *btn = [[SideMeunBtn alloc] initWithTitle:titleItems[i]]; 191 | [btn setFrame:CGRectMake(0, 0, kBtnWidth, kBtnHeight)]; 192 | CGFloat centerY= _blurView.center.y + (kBtnHeight + kBtnSpacing)*(i - midNum); 193 | [btn setCenter:CGPointMake(_keyWindow.frame.size.width/4, centerY)]; 194 | [self addSubview:btn]; 195 | 196 | __weak typeof(self)weakSelf = self; 197 | btn.BtnClickBlock = ^() { 198 | [weakSelf tapOnBlurView:nil]; 199 | weakSelf.menuBtnClick(titleItems[i]); 200 | }; 201 | } 202 | } 203 | } 204 | 205 | @end 206 | -------------------------------------------------------------------------------- /SideAnimation/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SideAnimation 4 | // 5 | // Created by 宫城 on 15/10/24. 6 | // Copyright © 2015年 宫城. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /SideAnimation/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // SideAnimation 4 | // 5 | // Created by 宫城 on 15/10/24. 6 | // Copyright © 2015年 宫城. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "SideView.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (nonatomic, strong) SideView *sideView; 15 | 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | self.title = @"首页"; 24 | self.view.backgroundColor = [UIColor whiteColor]; 25 | _sideView = [[SideView alloc] initWithTitleItems:@[@"首页",@"消息",@"推荐",@"更多",@"1",@"2",@"3"]]; 26 | _sideView.menuBtnClick = ^(NSString *title) { 27 | NSLog(@"title %@",title); 28 | }; 29 | 30 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; 31 | [btn setFrame:CGRectMake(200, 300, 100, 100)]; 32 | [btn setTitle:@"trigger" forState:UIControlStateNormal]; 33 | [btn setBackgroundColor:[UIColor orangeColor]]; 34 | [btn addTarget:self action:@selector(showSideView:) forControlEvents:UIControlEventTouchUpInside]; 35 | [self.view addSubview:btn]; 36 | 37 | UIPanGestureRecognizer *panGes = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panShowSideView:)]; 38 | [self.view addGestureRecognizer:panGes]; 39 | // Do any additional setup after loading the view, typically from a nib. 40 | } 41 | 42 | - (void)didReceiveMemoryWarning { 43 | [super didReceiveMemoryWarning]; 44 | // Dispose of any resources that can be recreated. 45 | } 46 | 47 | - (IBAction)showSideView:(id)sender { 48 | [_sideView trigger]; 49 | } 50 | 51 | - (void)panShowSideView:(UIPanGestureRecognizer *)panGes { 52 | CGPoint translationPoint = [panGes translationInView:self.view]; 53 | CGPoint velocityPoint = [panGes velocityInView:self.view]; 54 | if (translationPoint.x > 0 && (velocityPoint.x > 500 && fabs(velocityPoint.y) < 600)) { 55 | [_sideView trigger]; 56 | } 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /SideAnimation/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SideAnimation 4 | // 5 | // Created by 宫城 on 15/10/24. 6 | // Copyright © 2015年 宫城. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SideAnimationTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 | -------------------------------------------------------------------------------- /SideAnimationTests/SideAnimationTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SideAnimationTests.m 3 | // SideAnimationTests 4 | // 5 | // Created by 宫城 on 15/10/24. 6 | // Copyright © 2015年 宫城. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SideAnimationTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation SideAnimationTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /SideAnimationUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 | -------------------------------------------------------------------------------- /SideAnimationUITests/SideAnimationUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SideAnimationUITests.m 3 | // SideAnimationUITests 4 | // 5 | // Created by 宫城 on 15/10/24. 6 | // Copyright © 2015年 宫城. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SideAnimationUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation SideAnimationUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /SideMenuAnimation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuzeyang/SideMenuAnimation/50b5a29e8f7ad743018e9af384ad823d9e24e233/SideMenuAnimation.gif --------------------------------------------------------------------------------