├── .gitignore ├── KOMenuViewDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── KOMenuViewDemo ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── KOMenuView │ ├── KOMenuView.h │ ├── KOMenuView.m │ ├── UIView+Utils.h │ ├── UIView+Utils.m │ ├── menuClose@2x.png │ └── menuIcon@2x.png ├── ViewController.h ├── ViewController.m └── main.m ├── KOMenuViewDemoTests ├── Info.plist └── KOMenuViewDemoTests.m ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | # Pods/ 27 | -------------------------------------------------------------------------------- /KOMenuViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 38F1A8071AB5FB2A00508211 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 38F1A8061AB5FB2A00508211 /* main.m */; }; 11 | 38F1A80A1AB5FB2A00508211 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 38F1A8091AB5FB2A00508211 /* AppDelegate.m */; }; 12 | 38F1A80D1AB5FB2A00508211 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 38F1A80C1AB5FB2A00508211 /* ViewController.m */; }; 13 | 38F1A8101AB5FB2A00508211 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 38F1A80E1AB5FB2A00508211 /* Main.storyboard */; }; 14 | 38F1A8121AB5FB2A00508211 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 38F1A8111AB5FB2A00508211 /* Images.xcassets */; }; 15 | 38F1A8151AB5FB2A00508211 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 38F1A8131AB5FB2A00508211 /* LaunchScreen.xib */; }; 16 | 38F1A8211AB5FB2A00508211 /* KOMenuViewDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38F1A8201AB5FB2A00508211 /* KOMenuViewDemoTests.m */; }; 17 | 38F1A82D1AB5FB5100508211 /* KOMenuView.m in Sources */ = {isa = PBXBuildFile; fileRef = 38F1A82C1AB5FB5100508211 /* KOMenuView.m */; }; 18 | 38F1A8301AB5FD0300508211 /* UIView+Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 38F1A82F1AB5FD0300508211 /* UIView+Utils.m */; }; 19 | 38F1A8391AB6A0CB00508211 /* menuClose@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 38F1A8371AB6A0CB00508211 /* menuClose@2x.png */; }; 20 | 38F1A83A1AB6A0CB00508211 /* menuIcon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 38F1A8381AB6A0CB00508211 /* menuIcon@2x.png */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | 38F1A81B1AB5FB2A00508211 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = 38F1A7F91AB5FB2A00508211 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 38F1A8001AB5FB2A00508211; 29 | remoteInfo = KOMenuViewDemo; 30 | }; 31 | /* End PBXContainerItemProxy section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 38F1A8011AB5FB2A00508211 /* KOMenuViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KOMenuViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 38F1A8051AB5FB2A00508211 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | 38F1A8061AB5FB2A00508211 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 37 | 38F1A8081AB5FB2A00508211 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 38 | 38F1A8091AB5FB2A00508211 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 39 | 38F1A80B1AB5FB2A00508211 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 40 | 38F1A80C1AB5FB2A00508211 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 41 | 38F1A80F1AB5FB2A00508211 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 38F1A8111AB5FB2A00508211 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 43 | 38F1A8141AB5FB2A00508211 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 44 | 38F1A81A1AB5FB2A00508211 /* KOMenuViewDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KOMenuViewDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 38F1A81F1AB5FB2A00508211 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | 38F1A8201AB5FB2A00508211 /* KOMenuViewDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KOMenuViewDemoTests.m; sourceTree = ""; }; 47 | 38F1A82B1AB5FB5100508211 /* KOMenuView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KOMenuView.h; sourceTree = ""; }; 48 | 38F1A82C1AB5FB5100508211 /* KOMenuView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KOMenuView.m; sourceTree = ""; }; 49 | 38F1A82E1AB5FD0300508211 /* UIView+Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Utils.h"; sourceTree = ""; }; 50 | 38F1A82F1AB5FD0300508211 /* UIView+Utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Utils.m"; sourceTree = ""; }; 51 | 38F1A8371AB6A0CB00508211 /* menuClose@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "menuClose@2x.png"; sourceTree = ""; }; 52 | 38F1A8381AB6A0CB00508211 /* menuIcon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "menuIcon@2x.png"; sourceTree = ""; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | 38F1A7FE1AB5FB2A00508211 /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | 38F1A8171AB5FB2A00508211 /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | /* End PBXFrameworksBuildPhase section */ 71 | 72 | /* Begin PBXGroup section */ 73 | 38F1A7F81AB5FB2A00508211 = { 74 | isa = PBXGroup; 75 | children = ( 76 | 38F1A8031AB5FB2A00508211 /* KOMenuViewDemo */, 77 | 38F1A81D1AB5FB2A00508211 /* KOMenuViewDemoTests */, 78 | 38F1A8021AB5FB2A00508211 /* Products */, 79 | ); 80 | sourceTree = ""; 81 | }; 82 | 38F1A8021AB5FB2A00508211 /* Products */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 38F1A8011AB5FB2A00508211 /* KOMenuViewDemo.app */, 86 | 38F1A81A1AB5FB2A00508211 /* KOMenuViewDemoTests.xctest */, 87 | ); 88 | name = Products; 89 | sourceTree = ""; 90 | }; 91 | 38F1A8031AB5FB2A00508211 /* KOMenuViewDemo */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 38F1A82A1AB5FB4000508211 /* KOMenuView */, 95 | 38F1A8081AB5FB2A00508211 /* AppDelegate.h */, 96 | 38F1A8091AB5FB2A00508211 /* AppDelegate.m */, 97 | 38F1A80B1AB5FB2A00508211 /* ViewController.h */, 98 | 38F1A80C1AB5FB2A00508211 /* ViewController.m */, 99 | 38F1A80E1AB5FB2A00508211 /* Main.storyboard */, 100 | 38F1A8111AB5FB2A00508211 /* Images.xcassets */, 101 | 38F1A8131AB5FB2A00508211 /* LaunchScreen.xib */, 102 | 38F1A8041AB5FB2A00508211 /* Supporting Files */, 103 | ); 104 | path = KOMenuViewDemo; 105 | sourceTree = ""; 106 | }; 107 | 38F1A8041AB5FB2A00508211 /* Supporting Files */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 38F1A8051AB5FB2A00508211 /* Info.plist */, 111 | 38F1A8061AB5FB2A00508211 /* main.m */, 112 | ); 113 | name = "Supporting Files"; 114 | sourceTree = ""; 115 | }; 116 | 38F1A81D1AB5FB2A00508211 /* KOMenuViewDemoTests */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 38F1A8201AB5FB2A00508211 /* KOMenuViewDemoTests.m */, 120 | 38F1A81E1AB5FB2A00508211 /* Supporting Files */, 121 | ); 122 | path = KOMenuViewDemoTests; 123 | sourceTree = ""; 124 | }; 125 | 38F1A81E1AB5FB2A00508211 /* Supporting Files */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 38F1A81F1AB5FB2A00508211 /* Info.plist */, 129 | ); 130 | name = "Supporting Files"; 131 | sourceTree = ""; 132 | }; 133 | 38F1A82A1AB5FB4000508211 /* KOMenuView */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 38F1A8371AB6A0CB00508211 /* menuClose@2x.png */, 137 | 38F1A8381AB6A0CB00508211 /* menuIcon@2x.png */, 138 | 38F1A82E1AB5FD0300508211 /* UIView+Utils.h */, 139 | 38F1A82F1AB5FD0300508211 /* UIView+Utils.m */, 140 | 38F1A82B1AB5FB5100508211 /* KOMenuView.h */, 141 | 38F1A82C1AB5FB5100508211 /* KOMenuView.m */, 142 | ); 143 | path = KOMenuView; 144 | sourceTree = ""; 145 | }; 146 | /* End PBXGroup section */ 147 | 148 | /* Begin PBXNativeTarget section */ 149 | 38F1A8001AB5FB2A00508211 /* KOMenuViewDemo */ = { 150 | isa = PBXNativeTarget; 151 | buildConfigurationList = 38F1A8241AB5FB2A00508211 /* Build configuration list for PBXNativeTarget "KOMenuViewDemo" */; 152 | buildPhases = ( 153 | 38F1A7FD1AB5FB2A00508211 /* Sources */, 154 | 38F1A7FE1AB5FB2A00508211 /* Frameworks */, 155 | 38F1A7FF1AB5FB2A00508211 /* Resources */, 156 | ); 157 | buildRules = ( 158 | ); 159 | dependencies = ( 160 | ); 161 | name = KOMenuViewDemo; 162 | productName = KOMenuViewDemo; 163 | productReference = 38F1A8011AB5FB2A00508211 /* KOMenuViewDemo.app */; 164 | productType = "com.apple.product-type.application"; 165 | }; 166 | 38F1A8191AB5FB2A00508211 /* KOMenuViewDemoTests */ = { 167 | isa = PBXNativeTarget; 168 | buildConfigurationList = 38F1A8271AB5FB2A00508211 /* Build configuration list for PBXNativeTarget "KOMenuViewDemoTests" */; 169 | buildPhases = ( 170 | 38F1A8161AB5FB2A00508211 /* Sources */, 171 | 38F1A8171AB5FB2A00508211 /* Frameworks */, 172 | 38F1A8181AB5FB2A00508211 /* Resources */, 173 | ); 174 | buildRules = ( 175 | ); 176 | dependencies = ( 177 | 38F1A81C1AB5FB2A00508211 /* PBXTargetDependency */, 178 | ); 179 | name = KOMenuViewDemoTests; 180 | productName = KOMenuViewDemoTests; 181 | productReference = 38F1A81A1AB5FB2A00508211 /* KOMenuViewDemoTests.xctest */; 182 | productType = "com.apple.product-type.bundle.unit-test"; 183 | }; 184 | /* End PBXNativeTarget section */ 185 | 186 | /* Begin PBXProject section */ 187 | 38F1A7F91AB5FB2A00508211 /* Project object */ = { 188 | isa = PBXProject; 189 | attributes = { 190 | LastUpgradeCheck = 0620; 191 | ORGANIZATIONNAME = kino; 192 | TargetAttributes = { 193 | 38F1A8001AB5FB2A00508211 = { 194 | CreatedOnToolsVersion = 6.2; 195 | }; 196 | 38F1A8191AB5FB2A00508211 = { 197 | CreatedOnToolsVersion = 6.2; 198 | TestTargetID = 38F1A8001AB5FB2A00508211; 199 | }; 200 | }; 201 | }; 202 | buildConfigurationList = 38F1A7FC1AB5FB2A00508211 /* Build configuration list for PBXProject "KOMenuViewDemo" */; 203 | compatibilityVersion = "Xcode 3.2"; 204 | developmentRegion = English; 205 | hasScannedForEncodings = 0; 206 | knownRegions = ( 207 | en, 208 | Base, 209 | ); 210 | mainGroup = 38F1A7F81AB5FB2A00508211; 211 | productRefGroup = 38F1A8021AB5FB2A00508211 /* Products */; 212 | projectDirPath = ""; 213 | projectRoot = ""; 214 | targets = ( 215 | 38F1A8001AB5FB2A00508211 /* KOMenuViewDemo */, 216 | 38F1A8191AB5FB2A00508211 /* KOMenuViewDemoTests */, 217 | ); 218 | }; 219 | /* End PBXProject section */ 220 | 221 | /* Begin PBXResourcesBuildPhase section */ 222 | 38F1A7FF1AB5FB2A00508211 /* Resources */ = { 223 | isa = PBXResourcesBuildPhase; 224 | buildActionMask = 2147483647; 225 | files = ( 226 | 38F1A83A1AB6A0CB00508211 /* menuIcon@2x.png in Resources */, 227 | 38F1A8391AB6A0CB00508211 /* menuClose@2x.png in Resources */, 228 | 38F1A8101AB5FB2A00508211 /* Main.storyboard in Resources */, 229 | 38F1A8151AB5FB2A00508211 /* LaunchScreen.xib in Resources */, 230 | 38F1A8121AB5FB2A00508211 /* Images.xcassets in Resources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | 38F1A8181AB5FB2A00508211 /* Resources */ = { 235 | isa = PBXResourcesBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | }; 241 | /* End PBXResourcesBuildPhase section */ 242 | 243 | /* Begin PBXSourcesBuildPhase section */ 244 | 38F1A7FD1AB5FB2A00508211 /* Sources */ = { 245 | isa = PBXSourcesBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | 38F1A80D1AB5FB2A00508211 /* ViewController.m in Sources */, 249 | 38F1A82D1AB5FB5100508211 /* KOMenuView.m in Sources */, 250 | 38F1A80A1AB5FB2A00508211 /* AppDelegate.m in Sources */, 251 | 38F1A8301AB5FD0300508211 /* UIView+Utils.m in Sources */, 252 | 38F1A8071AB5FB2A00508211 /* main.m in Sources */, 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | }; 256 | 38F1A8161AB5FB2A00508211 /* Sources */ = { 257 | isa = PBXSourcesBuildPhase; 258 | buildActionMask = 2147483647; 259 | files = ( 260 | 38F1A8211AB5FB2A00508211 /* KOMenuViewDemoTests.m in Sources */, 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | /* End PBXSourcesBuildPhase section */ 265 | 266 | /* Begin PBXTargetDependency section */ 267 | 38F1A81C1AB5FB2A00508211 /* PBXTargetDependency */ = { 268 | isa = PBXTargetDependency; 269 | target = 38F1A8001AB5FB2A00508211 /* KOMenuViewDemo */; 270 | targetProxy = 38F1A81B1AB5FB2A00508211 /* PBXContainerItemProxy */; 271 | }; 272 | /* End PBXTargetDependency section */ 273 | 274 | /* Begin PBXVariantGroup section */ 275 | 38F1A80E1AB5FB2A00508211 /* Main.storyboard */ = { 276 | isa = PBXVariantGroup; 277 | children = ( 278 | 38F1A80F1AB5FB2A00508211 /* Base */, 279 | ); 280 | name = Main.storyboard; 281 | sourceTree = ""; 282 | }; 283 | 38F1A8131AB5FB2A00508211 /* LaunchScreen.xib */ = { 284 | isa = PBXVariantGroup; 285 | children = ( 286 | 38F1A8141AB5FB2A00508211 /* Base */, 287 | ); 288 | name = LaunchScreen.xib; 289 | sourceTree = ""; 290 | }; 291 | /* End PBXVariantGroup section */ 292 | 293 | /* Begin XCBuildConfiguration section */ 294 | 38F1A8221AB5FB2A00508211 /* Debug */ = { 295 | isa = XCBuildConfiguration; 296 | buildSettings = { 297 | ALWAYS_SEARCH_USER_PATHS = NO; 298 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 299 | CLANG_CXX_LIBRARY = "libc++"; 300 | CLANG_ENABLE_MODULES = YES; 301 | CLANG_ENABLE_OBJC_ARC = YES; 302 | CLANG_WARN_BOOL_CONVERSION = YES; 303 | CLANG_WARN_CONSTANT_CONVERSION = YES; 304 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 305 | CLANG_WARN_EMPTY_BODY = YES; 306 | CLANG_WARN_ENUM_CONVERSION = YES; 307 | CLANG_WARN_INT_CONVERSION = YES; 308 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 309 | CLANG_WARN_UNREACHABLE_CODE = YES; 310 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 311 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 312 | COPY_PHASE_STRIP = NO; 313 | ENABLE_STRICT_OBJC_MSGSEND = YES; 314 | GCC_C_LANGUAGE_STANDARD = gnu99; 315 | GCC_DYNAMIC_NO_PIC = NO; 316 | GCC_OPTIMIZATION_LEVEL = 0; 317 | GCC_PREPROCESSOR_DEFINITIONS = ( 318 | "DEBUG=1", 319 | "$(inherited)", 320 | ); 321 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 322 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 323 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 324 | GCC_WARN_UNDECLARED_SELECTOR = YES; 325 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 326 | GCC_WARN_UNUSED_FUNCTION = YES; 327 | GCC_WARN_UNUSED_VARIABLE = YES; 328 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 329 | MTL_ENABLE_DEBUG_INFO = YES; 330 | ONLY_ACTIVE_ARCH = YES; 331 | SDKROOT = iphoneos; 332 | }; 333 | name = Debug; 334 | }; 335 | 38F1A8231AB5FB2A00508211 /* Release */ = { 336 | isa = XCBuildConfiguration; 337 | buildSettings = { 338 | ALWAYS_SEARCH_USER_PATHS = NO; 339 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 340 | CLANG_CXX_LIBRARY = "libc++"; 341 | CLANG_ENABLE_MODULES = YES; 342 | CLANG_ENABLE_OBJC_ARC = YES; 343 | CLANG_WARN_BOOL_CONVERSION = YES; 344 | CLANG_WARN_CONSTANT_CONVERSION = YES; 345 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 346 | CLANG_WARN_EMPTY_BODY = YES; 347 | CLANG_WARN_ENUM_CONVERSION = YES; 348 | CLANG_WARN_INT_CONVERSION = YES; 349 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 350 | CLANG_WARN_UNREACHABLE_CODE = YES; 351 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 352 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 353 | COPY_PHASE_STRIP = NO; 354 | ENABLE_NS_ASSERTIONS = NO; 355 | ENABLE_STRICT_OBJC_MSGSEND = YES; 356 | GCC_C_LANGUAGE_STANDARD = gnu99; 357 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 358 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 359 | GCC_WARN_UNDECLARED_SELECTOR = YES; 360 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 361 | GCC_WARN_UNUSED_FUNCTION = YES; 362 | GCC_WARN_UNUSED_VARIABLE = YES; 363 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 364 | MTL_ENABLE_DEBUG_INFO = NO; 365 | SDKROOT = iphoneos; 366 | VALIDATE_PRODUCT = YES; 367 | }; 368 | name = Release; 369 | }; 370 | 38F1A8251AB5FB2A00508211 /* Debug */ = { 371 | isa = XCBuildConfiguration; 372 | buildSettings = { 373 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 374 | INFOPLIST_FILE = KOMenuViewDemo/Info.plist; 375 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 376 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 377 | PRODUCT_NAME = "$(TARGET_NAME)"; 378 | }; 379 | name = Debug; 380 | }; 381 | 38F1A8261AB5FB2A00508211 /* Release */ = { 382 | isa = XCBuildConfiguration; 383 | buildSettings = { 384 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 385 | INFOPLIST_FILE = KOMenuViewDemo/Info.plist; 386 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 387 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 388 | PRODUCT_NAME = "$(TARGET_NAME)"; 389 | }; 390 | name = Release; 391 | }; 392 | 38F1A8281AB5FB2A00508211 /* Debug */ = { 393 | isa = XCBuildConfiguration; 394 | buildSettings = { 395 | BUNDLE_LOADER = "$(TEST_HOST)"; 396 | FRAMEWORK_SEARCH_PATHS = ( 397 | "$(SDKROOT)/Developer/Library/Frameworks", 398 | "$(inherited)", 399 | ); 400 | GCC_PREPROCESSOR_DEFINITIONS = ( 401 | "DEBUG=1", 402 | "$(inherited)", 403 | ); 404 | INFOPLIST_FILE = KOMenuViewDemoTests/Info.plist; 405 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 406 | PRODUCT_NAME = "$(TARGET_NAME)"; 407 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/KOMenuViewDemo.app/KOMenuViewDemo"; 408 | }; 409 | name = Debug; 410 | }; 411 | 38F1A8291AB5FB2A00508211 /* Release */ = { 412 | isa = XCBuildConfiguration; 413 | buildSettings = { 414 | BUNDLE_LOADER = "$(TEST_HOST)"; 415 | FRAMEWORK_SEARCH_PATHS = ( 416 | "$(SDKROOT)/Developer/Library/Frameworks", 417 | "$(inherited)", 418 | ); 419 | INFOPLIST_FILE = KOMenuViewDemoTests/Info.plist; 420 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 421 | PRODUCT_NAME = "$(TARGET_NAME)"; 422 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/KOMenuViewDemo.app/KOMenuViewDemo"; 423 | }; 424 | name = Release; 425 | }; 426 | /* End XCBuildConfiguration section */ 427 | 428 | /* Begin XCConfigurationList section */ 429 | 38F1A7FC1AB5FB2A00508211 /* Build configuration list for PBXProject "KOMenuViewDemo" */ = { 430 | isa = XCConfigurationList; 431 | buildConfigurations = ( 432 | 38F1A8221AB5FB2A00508211 /* Debug */, 433 | 38F1A8231AB5FB2A00508211 /* Release */, 434 | ); 435 | defaultConfigurationIsVisible = 0; 436 | defaultConfigurationName = Release; 437 | }; 438 | 38F1A8241AB5FB2A00508211 /* Build configuration list for PBXNativeTarget "KOMenuViewDemo" */ = { 439 | isa = XCConfigurationList; 440 | buildConfigurations = ( 441 | 38F1A8251AB5FB2A00508211 /* Debug */, 442 | 38F1A8261AB5FB2A00508211 /* Release */, 443 | ); 444 | defaultConfigurationIsVisible = 0; 445 | defaultConfigurationName = Release; 446 | }; 447 | 38F1A8271AB5FB2A00508211 /* Build configuration list for PBXNativeTarget "KOMenuViewDemoTests" */ = { 448 | isa = XCConfigurationList; 449 | buildConfigurations = ( 450 | 38F1A8281AB5FB2A00508211 /* Debug */, 451 | 38F1A8291AB5FB2A00508211 /* Release */, 452 | ); 453 | defaultConfigurationIsVisible = 0; 454 | defaultConfigurationName = Release; 455 | }; 456 | /* End XCConfigurationList section */ 457 | }; 458 | rootObject = 38F1A7F91AB5FB2A00508211 /* Project object */; 459 | } 460 | -------------------------------------------------------------------------------- /KOMenuViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /KOMenuViewDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // KOMenuViewDemo 4 | // 5 | // Created by kino on 15/3/16. 6 | // Copyright (c) 2015年 kino. 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 | -------------------------------------------------------------------------------- /KOMenuViewDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // KOMenuViewDemo 4 | // 5 | // Created by kino on 15/3/16. 6 | // Copyright (c) 2015年 kino. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // 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. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // 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. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /KOMenuViewDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /KOMenuViewDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /KOMenuViewDemo/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" : "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 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /KOMenuViewDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | Kino.$(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 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /KOMenuViewDemo/KOMenuView/KOMenuView.h: -------------------------------------------------------------------------------- 1 | // 2 | // KOMenuView.h 3 | // KOMenuViewDemo 4 | // Beta 5 | // Created by kino on 15/3/16. 6 | // Copyright (c) 2015年 kino. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void(^KOMenuClickBlock)(NSInteger itemIndex); 12 | typedef void(^KOMenuframeChangeBlock)(CGRect destFrame); 13 | 14 | @protocol KOMenuViewDelegate 15 | 16 | - (void)menuViewWillChangeInAnimation:(CGRect)destFrame; 17 | 18 | - (void)menuDidClickByIndex:(NSInteger)itemIndex; 19 | 20 | @end 21 | 22 | 23 | @interface KOMenuView : UIView 24 | 25 | @property (weak, nonatomic) id delegate; 26 | 27 | 28 | ///fold menu automatically when select item,default NO 29 | @property (assign, nonatomic) BOOL foldMenuWhenClickItem; 30 | ///animation duration, default 0.25 31 | @property (assign, nonatomic) CGFloat animaDuration; 32 | 33 | 34 | @property (copy, nonatomic) KOMenuClickBlock clickHandle; 35 | @property (copy, nonatomic) KOMenuframeChangeBlock frameChangedHandle; 36 | 37 | 38 | 39 | + (instancetype)menuViewWithItem:(NSArray *)items 40 | withPlaceView:(UIView *)view; 41 | 42 | + (instancetype)menuViewWithItem:(NSArray *)items 43 | withPlaceView:(UIView *)view 44 | withClickByIndex:(KOMenuClickBlock)clickhandle; 45 | 46 | + (instancetype)menuViewWithItem:(NSArray *)items 47 | itemHeight:(CGFloat)itemHeight 48 | withPlaceView:(UIView *)view 49 | withClickByIndex:(KOMenuClickBlock)clickhandle; 50 | 51 | @end 52 | 53 | -------------------------------------------------------------------------------- /KOMenuViewDemo/KOMenuView/KOMenuView.m: -------------------------------------------------------------------------------- 1 | // 2 | // KOMenuView.m 3 | // KOMenuViewDemo 4 | // 5 | // Created by kino on 15/3/16. 6 | // Copyright (c) 2015年 kino. All rights reserved. 7 | // 8 | 9 | #import "KOMenuView.h" 10 | #import "UIView+Utils.h" 11 | 12 | static const CGFloat MenuItemHeightDefault = 50.f; 13 | static const CGFloat MenuItemPadding = 1.f; 14 | 15 | static const CGFloat expandHeight = 30.f; 16 | 17 | @interface KOMenuView() 18 | 19 | @property (strong, nonatomic) UIToolbar *backBLurView; 20 | @property (strong, nonatomic) NSMutableArray *menuItems; 21 | @property (strong, nonatomic) UIView *menuControlItem; 22 | @property (strong, nonatomic) CALayer *menuControlFlagLayer; 23 | 24 | @property (weak, nonatomic) UIView *placeView; 25 | 26 | @property (assign, nonatomic, getter=isExpandMenu) BOOL expandMenu; 27 | @property (assign, nonatomic) CGFloat itemViewHeight; 28 | 29 | @end 30 | 31 | @implementation KOMenuView 32 | 33 | - (NSMutableArray *)menuItems{ 34 | if (_menuItems == nil) { 35 | _menuItems = [[NSMutableArray alloc] init]; 36 | } 37 | return _menuItems; 38 | } 39 | 40 | + (instancetype)menuViewWithItem:(NSArray *)items 41 | withPlaceView:(UIView *)view{ 42 | return [KOMenuView menuViewWithItem:items 43 | withPlaceView:view 44 | withClickByIndex:nil]; 45 | } 46 | 47 | + (instancetype)menuViewWithItem:(NSArray *)items 48 | withPlaceView:(UIView *)view 49 | withClickByIndex:(KOMenuClickBlock)clickhandle{ 50 | return [KOMenuView menuViewWithItem:items itemHeight:MenuItemHeightDefault 51 | withPlaceView:view withClickByIndex:clickhandle]; 52 | } 53 | 54 | + (instancetype)menuViewWithItem:(NSArray *)items 55 | itemHeight:(CGFloat)itemHeight 56 | withPlaceView:(UIView *)view 57 | withClickByIndex:(KOMenuClickBlock)clickhandle{ 58 | KOMenuView *menuView = [[KOMenuView alloc] initWithFrame: 59 | CGRectMake(0, view.frame.size.height - itemHeight, 60 | view.frame.size.width, itemHeight) 61 | withPlaceView:view itemHeight:itemHeight]; 62 | menuView.clickHandle = clickhandle; 63 | [menuView setItems:items]; 64 | 65 | return menuView; 66 | } 67 | 68 | - (id)init{ 69 | if (self = [super init]) { 70 | [self commonInit]; 71 | } 72 | return self; 73 | } 74 | 75 | - (id)initWithFrame:(CGRect)frame{ 76 | if (self = [super initWithFrame:frame]) { 77 | [self commonInit]; 78 | } 79 | return self; 80 | } 81 | 82 | - (id)initWithFrame:(CGRect)frame withPlaceView:(UIView *)placeView{ 83 | if (self = [super initWithFrame:frame]) { 84 | self.placeView = placeView; 85 | [self commonInit]; 86 | } 87 | return self; 88 | } 89 | 90 | - (id)initWithFrame:(CGRect)frame withPlaceView:(UIView *)placeView itemHeight:(CGFloat)itemHeight{ 91 | if (self = [super initWithFrame:frame]) { 92 | self.placeView = placeView; 93 | self.itemViewHeight = itemHeight; 94 | [self commonInit]; 95 | } 96 | return self; 97 | } 98 | 99 | - (void)commonInit{ 100 | //default setting 101 | self.animaDuration = 0.25; 102 | self.itemViewHeight = (_itemViewHeight == 0.f ? MenuItemHeightDefault : _itemViewHeight); 103 | 104 | _backBLurView = [[UIToolbar alloc] init]; 105 | _backBLurView.barStyle = UIBarStyleBlackOpaque; 106 | 107 | [self addSubview:_backBLurView]; 108 | 109 | _menuControlItem = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, _itemViewHeight)]; 110 | _menuControlFlagLayer = [CALayer layer]; 111 | UIImage *flagImage = [UIImage imageNamed:@"menuIcon"]; 112 | _menuControlFlagLayer.frame = CGRectMake(_menuControlItem.width/2 - flagImage.size.width/2, 113 | _menuControlItem.height/2 - flagImage.size.height/2, 114 | flagImage.size.width, flagImage.size.height); 115 | _menuControlFlagLayer.contents = (id)flagImage.CGImage; 116 | [_menuControlItem.layer addSublayer:_menuControlFlagLayer]; 117 | _menuControlItem.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3]; 118 | 119 | [self addSubview:_menuControlItem]; 120 | 121 | } 122 | 123 | - (void)layoutSubviews{ 124 | _backBLurView.frame = self.bounds; 125 | 126 | [super layoutSubviews]; 127 | } 128 | 129 | 130 | - (void)setItems:(NSArray *)items{ 131 | [self.menuItems removeAllObjects]; 132 | 133 | NSInteger lastPositionY = self.itemViewHeight; 134 | for (NSString *itemName in items) { 135 | 136 | //create sub view 137 | UIView *itemView = [[UIView alloc] initWithFrame: 138 | CGRectMake(0, lastPositionY, self.frame.size.width, self.itemViewHeight)]; 139 | itemView.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3]; 140 | 141 | UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, itemView.width - 40, itemView.height)]; 142 | titleLabel.text = itemName; 143 | titleLabel.font = [UIFont systemFontOfSize:16.f]; 144 | titleLabel.textColor = [UIColor whiteColor]; 145 | [itemView addSubview:titleLabel]; 146 | 147 | [self addSubview:itemView]; 148 | //add to self array to manage 149 | [self.menuItems addObject:itemView]; 150 | //calculate next position 151 | lastPositionY += (self.itemViewHeight + MenuItemPadding); 152 | } 153 | } 154 | 155 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ 156 | CGPoint touchPt = [[touches anyObject] locationInView:self]; 157 | 158 | if (CGRectContainsPoint(_menuControlItem.frame, touchPt)) { 159 | //touch control item, expand or not 160 | [self expandOrFoldMenu]; 161 | }else{ 162 | [self.menuItems enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { 163 | UIView *itemView = obj; 164 | if (CGRectContainsPoint(itemView.frame, touchPt)) { 165 | if ([self.delegate respondsToSelector:@selector(menuDidClickByIndex:)]) { 166 | [self.delegate menuDidClickByIndex:idx]; 167 | } 168 | 169 | if (self.clickHandle) { 170 | self.clickHandle(idx); 171 | } 172 | 173 | if (self.foldMenuWhenClickItem) { 174 | [self expandOrFoldMenu]; 175 | } 176 | 177 | *stop = true; 178 | } 179 | }]; 180 | } 181 | } 182 | 183 | - (void)expandOrFoldMenu{ 184 | if (self.expandMenu) { 185 | //fold 186 | NSInteger height = self.itemViewHeight; 187 | [self updateMenuItemPosition]; 188 | [UIView animateWithDuration:self.animaDuration 189 | delay:0 190 | usingSpringWithDamping:0.8 191 | initialSpringVelocity:5 192 | options:UIViewAnimationOptionCurveEaseInOut 193 | animations:^{ 194 | //calc all height 195 | self.top += (self.height - height); 196 | 197 | if ([self.delegate respondsToSelector:@selector(menuViewWillChangeInAnimation:)]) { 198 | [self.delegate menuViewWillChangeInAnimation:self.frame]; 199 | } 200 | 201 | } completion:^(BOOL finished) { 202 | self.expandMenu = false; 203 | _menuControlFlagLayer.contents = (id)[UIImage imageNamed:@"menuIcon"].CGImage; 204 | }]; 205 | }else{ 206 | if (self.menuItems.count <= 0) return; 207 | 208 | //expand 209 | NSInteger height = (self.menuItems.count + 1) * self.itemViewHeight + 210 | (self.menuItems.count * MenuItemPadding) + expandHeight; 211 | [self updateMenuItemPosition]; 212 | [UIView animateWithDuration:self.animaDuration 213 | delay:0 214 | usingSpringWithDamping:0.8 215 | initialSpringVelocity:5 216 | options:UIViewAnimationOptionCurveEaseInOut 217 | animations:^{ 218 | //calc all height 219 | self.height = height; 220 | self.top -= (height - self.itemViewHeight - expandHeight); 221 | 222 | if ([self.delegate respondsToSelector:@selector(menuViewWillChangeInAnimation:)]) { 223 | [self.delegate menuViewWillChangeInAnimation:self.frame]; 224 | } 225 | } completion:^(BOOL finished) { 226 | self.expandMenu = true; 227 | _menuControlFlagLayer.contents = (id)[UIImage imageNamed:@"menuClose"].CGImage; 228 | self.height -= expandHeight; 229 | }]; 230 | } 231 | } 232 | 233 | - (void)updateMenuItemPosition{ 234 | if (self.expandMenu) { 235 | [self.menuItems enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { 236 | UIView *itemView = obj; 237 | itemView.frame = CGRectMake(0, (idx+1) * self.itemViewHeight + idx*MenuItemPadding, 238 | itemView.width, itemView.height); 239 | }]; 240 | self.menuControlItem.frame = CGRectMake(0, 0, 241 | self.menuControlItem.width, 242 | self.menuControlItem.height); 243 | }else{ 244 | [self.menuItems enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { 245 | UIView *itemView = obj; 246 | itemView.frame = CGRectMake(0, idx * self.itemViewHeight + idx*MenuItemPadding, 247 | itemView.width, itemView.height); 248 | }]; 249 | self.menuControlItem.frame = CGRectMake(0, 250 | self.menuItems.count * self.itemViewHeight + 251 | (self.menuItems.count) * MenuItemPadding, 252 | self.menuControlItem.width, 253 | self.menuControlItem.height); 254 | } 255 | } 256 | @end 257 | -------------------------------------------------------------------------------- /KOMenuViewDemo/KOMenuView/UIView+Utils.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Utils.h 3 | // Borrowed from Three20 / DTFoundation 4 | // 5 | // Copyright (c) 2013 iOS. No rights reserved. 6 | // 7 | 8 | #import 9 | 10 | 11 | @interface UIView (Utils) 12 | 13 | /** 14 | * Shortcut for frame.origin.x. 15 | * 16 | * Sets frame.origin.x = left 17 | */ 18 | @property (nonatomic) CGFloat left; 19 | 20 | /** 21 | * Shortcut for frame.origin.y 22 | * 23 | * Sets frame.origin.y = top 24 | */ 25 | @property (nonatomic) CGFloat top; 26 | 27 | /** 28 | * Shortcut for frame.origin.x + frame.size.width 29 | * 30 | * Sets frame.origin.x = right - frame.size.width 31 | */ 32 | @property (nonatomic) CGFloat right; 33 | 34 | /** 35 | * Shortcut for frame.origin.y + frame.size.height 36 | * 37 | * Sets frame.origin.y = bottom - frame.size.height 38 | */ 39 | @property (nonatomic) CGFloat bottom; 40 | 41 | /** 42 | * Shortcut for frame.size.width 43 | * 44 | * Sets frame.size.width = width 45 | */ 46 | @property (nonatomic) CGFloat width; 47 | 48 | /** 49 | * Shortcut for frame.size.height 50 | * 51 | * Sets frame.size.height = height 52 | */ 53 | @property (nonatomic) CGFloat height; 54 | 55 | /** 56 | * Shortcut for center.x 57 | * 58 | * Sets center.x = centerX 59 | */ 60 | @property (nonatomic) CGFloat centerX; 61 | 62 | /** 63 | * Shortcut for center.y 64 | * 65 | * Sets center.y = centerY 66 | */ 67 | @property (nonatomic) CGFloat centerY; 68 | 69 | /** 70 | * Return the x coordinate on the screen. 71 | */ 72 | @property (nonatomic, readonly) CGFloat screenX; 73 | 74 | /** 75 | * Return the y coordinate on the screen. 76 | */ 77 | @property (nonatomic, readonly) CGFloat screenY; 78 | 79 | /** 80 | * Return the x coordinate on the screen, taking into account scroll views. 81 | */ 82 | @property (nonatomic, readonly) CGFloat screenViewX; 83 | 84 | /** 85 | * Return the y coordinate on the screen, taking into account scroll views. 86 | */ 87 | @property (nonatomic, readonly) CGFloat screenViewY; 88 | 89 | /** 90 | * Return the view frame on the screen, taking into account scroll views. 91 | */ 92 | @property (nonatomic, readonly) CGRect screenFrame; 93 | 94 | /** 95 | * Shortcut for frame.origin 96 | */ 97 | @property (nonatomic) CGPoint origin; 98 | 99 | /** 100 | * Shortcut for frame.size 101 | */ 102 | @property (nonatomic) CGSize size; 103 | 104 | /** 105 | * Return the width in portrait or the height in landscape. 106 | */ 107 | @property (nonatomic, readonly) CGFloat orientationWidth; 108 | 109 | /** 110 | * Return the height in portrait or the width in landscape. 111 | */ 112 | @property (nonatomic, readonly) CGFloat orientationHeight; 113 | 114 | /** 115 | * Finds the first descendant view (including this view) that is a member of a particular class. 116 | */ 117 | - (UIView*)descendantOrSelfWithClass:(Class)cls; 118 | 119 | /** 120 | * Finds the first ancestor view (including this view) that is a member of a particular class. 121 | */ 122 | - (UIView*)ancestorOrSelfWithClass:(Class)cls; 123 | 124 | /** 125 | * Removes all subviews. 126 | */ 127 | - (void)removeAllSubviews; 128 | 129 | /** 130 | Attaches the given block for a single tap action to the receiver. 131 | @param block The block to execute. 132 | */ 133 | - (void)setTapActionWithBlock:(void (^)(void))block; 134 | 135 | /** 136 | Attaches the given block for a long press action to the receiver. 137 | @param block The block to execute. 138 | */ 139 | - (void)setLongPressActionWithBlock:(void (^)(void))block; 140 | 141 | @end 142 | -------------------------------------------------------------------------------- /KOMenuViewDemo/KOMenuView/UIView+Utils.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Utils.m 3 | // Borrowed from Three20 4 | // 5 | // Copyright (c) 2013 iOS. No rights reserved. 6 | // 7 | 8 | #import "UIView+Utils.h" 9 | 10 | #import 11 | 12 | static char kDTActionHandlerTapBlockKey; 13 | static char kDTActionHandlerTapGestureKey; 14 | static char kDTActionHandlerLongPressBlockKey; 15 | static char kDTActionHandlerLongPressGestureKey; 16 | 17 | @implementation UIView (Utils) 18 | 19 | 20 | - (CGFloat)left { 21 | return self.frame.origin.x; 22 | } 23 | 24 | 25 | 26 | - (void)setLeft:(CGFloat)x { 27 | CGRect frame = self.frame; 28 | frame.origin.x = x; 29 | self.frame = frame; 30 | } 31 | 32 | 33 | 34 | - (CGFloat)top { 35 | return self.frame.origin.y; 36 | } 37 | 38 | 39 | 40 | - (void)setTop:(CGFloat)y { 41 | CGRect frame = self.frame; 42 | frame.origin.y = y; 43 | self.frame = frame; 44 | } 45 | 46 | 47 | 48 | - (CGFloat)right { 49 | return self.frame.origin.x + self.frame.size.width; 50 | } 51 | 52 | 53 | 54 | - (void)setRight:(CGFloat)right { 55 | CGRect frame = self.frame; 56 | frame.origin.x = right - frame.size.width; 57 | self.frame = frame; 58 | } 59 | 60 | 61 | 62 | - (CGFloat)bottom { 63 | return self.frame.origin.y + self.frame.size.height; 64 | } 65 | 66 | 67 | 68 | - (void)setBottom:(CGFloat)bottom { 69 | CGRect frame = self.frame; 70 | frame.origin.y = bottom - frame.size.height; 71 | self.frame = frame; 72 | } 73 | 74 | 75 | 76 | - (CGFloat)centerX { 77 | return self.center.x; 78 | } 79 | 80 | 81 | 82 | - (void)setCenterX:(CGFloat)centerX { 83 | self.center = CGPointMake(centerX, self.center.y); 84 | } 85 | 86 | 87 | 88 | - (CGFloat)centerY { 89 | return self.center.y; 90 | } 91 | 92 | 93 | 94 | - (void)setCenterY:(CGFloat)centerY { 95 | self.center = CGPointMake(self.center.x, centerY); 96 | } 97 | 98 | 99 | 100 | - (CGFloat)width { 101 | return self.frame.size.width; 102 | } 103 | 104 | 105 | 106 | - (void)setWidth:(CGFloat)width { 107 | CGRect frame = self.frame; 108 | frame.size.width = width; 109 | self.frame = frame; 110 | } 111 | 112 | 113 | 114 | - (CGFloat)height { 115 | return self.frame.size.height; 116 | } 117 | 118 | 119 | 120 | - (void)setHeight:(CGFloat)height { 121 | CGRect frame = self.frame; 122 | frame.size.height = height; 123 | self.frame = frame; 124 | } 125 | 126 | 127 | 128 | - (CGFloat)screenX { 129 | CGFloat x = 0.0f; 130 | for (UIView* view = self; view; view = view.superview) { 131 | x += view.left; 132 | } 133 | return x; 134 | } 135 | 136 | 137 | 138 | - (CGFloat)screenY { 139 | CGFloat y = 0.0f; 140 | for (UIView* view = self; view; view = view.superview) { 141 | y += view.top; 142 | } 143 | return y; 144 | } 145 | 146 | 147 | 148 | - (CGFloat)screenViewX { 149 | CGFloat x = 0.0f; 150 | for (UIView* view = self; view; view = view.superview) { 151 | x += view.left; 152 | 153 | if ([view isKindOfClass:[UIScrollView class]]) { 154 | UIScrollView* scrollView = (UIScrollView*)view; 155 | x -= scrollView.contentOffset.x; 156 | } 157 | } 158 | 159 | return x; 160 | } 161 | 162 | 163 | 164 | - (CGFloat)screenViewY { 165 | CGFloat y = 0; 166 | for (UIView* view = self; view; view = view.superview) { 167 | y += view.top; 168 | 169 | if ([view isKindOfClass:[UIScrollView class]]) { 170 | UIScrollView* scrollView = (UIScrollView*)view; 171 | y -= scrollView.contentOffset.y; 172 | } 173 | } 174 | return y; 175 | } 176 | 177 | 178 | 179 | - (CGRect)screenFrame { 180 | return CGRectMake(self.screenViewX, self.screenViewY, self.width, self.height); 181 | } 182 | 183 | 184 | 185 | - (CGPoint)origin { 186 | return self.frame.origin; 187 | } 188 | 189 | 190 | 191 | - (void)setOrigin:(CGPoint)origin { 192 | CGRect frame = self.frame; 193 | frame.origin = origin; 194 | self.frame = frame; 195 | } 196 | 197 | 198 | 199 | - (CGSize)size { 200 | return self.frame.size; 201 | } 202 | 203 | 204 | 205 | - (void)setSize:(CGSize)size { 206 | CGRect frame = self.frame; 207 | frame.size = size; 208 | self.frame = frame; 209 | } 210 | 211 | 212 | 213 | - (CGFloat)orientationWidth { 214 | return UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation) 215 | ? self.height : self.width; 216 | } 217 | 218 | 219 | 220 | - (CGFloat)orientationHeight { 221 | return UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation) 222 | ? self.width : self.height; 223 | } 224 | 225 | 226 | 227 | - (UIView*)descendantOrSelfWithClass:(Class)cls { 228 | if ([self isKindOfClass:cls]) 229 | return self; 230 | 231 | for (UIView* child in self.subviews) { 232 | UIView* it = [child descendantOrSelfWithClass:cls]; 233 | if (it) 234 | return it; 235 | } 236 | 237 | return nil; 238 | } 239 | 240 | 241 | 242 | - (UIView*)ancestorOrSelfWithClass:(Class)cls { 243 | if ([self isKindOfClass:cls]) { 244 | return self; 245 | 246 | } else if (self.superview) { 247 | return [self.superview ancestorOrSelfWithClass:cls]; 248 | 249 | } else { 250 | return nil; 251 | } 252 | } 253 | 254 | 255 | 256 | - (void)removeAllSubviews { 257 | while (self.subviews.count) { 258 | UIView* child = self.subviews.lastObject; 259 | [child removeFromSuperview]; 260 | } 261 | } 262 | 263 | 264 | 265 | - (CGPoint)offsetFromView:(UIView*)otherView { 266 | CGFloat x = 0.0f, y = 0.0f; 267 | for (UIView* view = self; view && view != otherView; view = view.superview) { 268 | x += view.left; 269 | y += view.top; 270 | } 271 | return CGPointMake(x, y); 272 | } 273 | 274 | 275 | - (void)setTapActionWithBlock:(void (^)(void))block 276 | { 277 | UITapGestureRecognizer *gesture = objc_getAssociatedObject(self, &kDTActionHandlerTapGestureKey); 278 | 279 | if (!gesture) 280 | { 281 | gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(__handleActionForTapGesture:)]; 282 | [self addGestureRecognizer:gesture]; 283 | objc_setAssociatedObject(self, &kDTActionHandlerTapGestureKey, gesture, OBJC_ASSOCIATION_RETAIN); 284 | } 285 | 286 | objc_setAssociatedObject(self, &kDTActionHandlerTapBlockKey, block, OBJC_ASSOCIATION_COPY); 287 | } 288 | 289 | - (void)__handleActionForTapGesture:(UITapGestureRecognizer *)gesture 290 | { 291 | if (gesture.state == UIGestureRecognizerStateRecognized) 292 | { 293 | void(^action)(void) = objc_getAssociatedObject(self, &kDTActionHandlerTapBlockKey); 294 | 295 | if (action) 296 | { 297 | action(); 298 | } 299 | } 300 | } 301 | 302 | - (void)setLongPressActionWithBlock:(void (^)(void))block 303 | { 304 | UILongPressGestureRecognizer *gesture = objc_getAssociatedObject(self, &kDTActionHandlerLongPressGestureKey); 305 | 306 | if (!gesture) 307 | { 308 | gesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(__handleActionForLongPressGesture:)]; 309 | [self addGestureRecognizer:gesture]; 310 | objc_setAssociatedObject(self, &kDTActionHandlerLongPressGestureKey, gesture, OBJC_ASSOCIATION_RETAIN); 311 | } 312 | 313 | objc_setAssociatedObject(self, &kDTActionHandlerLongPressBlockKey, block, OBJC_ASSOCIATION_COPY); 314 | } 315 | 316 | - (void)__handleActionForLongPressGesture:(UITapGestureRecognizer *)gesture 317 | { 318 | if (gesture.state == UIGestureRecognizerStateBegan) 319 | { 320 | void(^action)(void) = objc_getAssociatedObject(self, &kDTActionHandlerLongPressBlockKey); 321 | 322 | if (action) 323 | { 324 | action(); 325 | } 326 | } 327 | } 328 | 329 | @end 330 | -------------------------------------------------------------------------------- /KOMenuViewDemo/KOMenuView/menuClose@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KinoAndWorld/KOMenuView/f9d7d57933c6ce28f99950191113dc9bd0adb263/KOMenuViewDemo/KOMenuView/menuClose@2x.png -------------------------------------------------------------------------------- /KOMenuViewDemo/KOMenuView/menuIcon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KinoAndWorld/KOMenuView/f9d7d57933c6ce28f99950191113dc9bd0adb263/KOMenuViewDemo/KOMenuView/menuIcon@2x.png -------------------------------------------------------------------------------- /KOMenuViewDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // KOMenuViewDemo 4 | // 5 | // Created by kino on 15/3/16. 6 | // Copyright (c) 2015年 kino. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /KOMenuViewDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // KOMenuViewDemo 4 | // 5 | // Created by kino on 15/3/16. 6 | // Copyright (c) 2015年 kino. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "KOMenuView.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (strong, nonatomic) KOMenuView *blurMenuView; 15 | @property (weak, nonatomic) IBOutlet UITableView *tableView; 16 | 17 | @end 18 | 19 | @implementation ViewController 20 | 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | _blurMenuView = [KOMenuView menuViewWithItem:@[@"Menu 01",@"Menu 02",@"Menu 03",@"Menu 04",@"Menu 05"] 26 | withPlaceView:self.view 27 | withClickByIndex:^(NSInteger itemIndex) { 28 | NSLog(@"itemIndex : %ld",(long)itemIndex); 29 | }]; 30 | _blurMenuView.foldMenuWhenClickItem = YES; ///fold menu automatically when select item,default NO 31 | _blurMenuView.animaDuration = 0.3; ///animation duration, default 0.25 32 | 33 | 34 | 35 | [self.view addSubview:_blurMenuView]; 36 | 37 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"]; 38 | } 39 | 40 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 41 | return 8; 42 | } 43 | 44 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ 45 | return 120.f; 46 | } 47 | 48 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 49 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; 50 | 51 | 52 | cell.backgroundColor = [UIColor colorWithRed:0.12 * indexPath.row green:0.8 blue:0.9 alpha:1.0]; 53 | 54 | cell.textLabel.text = [NSString stringWithFormat:@"PlaceHolder Text : %ld",(long)indexPath.row]; 55 | return cell; 56 | } 57 | 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /KOMenuViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // KOMenuViewDemo 4 | // 5 | // Created by kino on 15/3/16. 6 | // Copyright (c) 2015年 kino. 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 | -------------------------------------------------------------------------------- /KOMenuViewDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | Kino.$(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 | -------------------------------------------------------------------------------- /KOMenuViewDemoTests/KOMenuViewDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // KOMenuViewDemoTests.m 3 | // KOMenuViewDemoTests 4 | // 5 | // Created by kino on 15/3/16. 6 | // Copyright (c) 2015年 kino. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface KOMenuViewDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation KOMenuViewDemoTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Kino 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KOMenuView 2 | 3 | *** 4 | 5 | This is a simple Menu View On One's View Bottom. 6 | 7 | ![Screenshot](http://ww3.sinaimg.cn/large/6ff7b43ejw1eq7krl21p3g207g0dc4qq.gif) 8 | 9 | ## Features 10 | 11 | - spring bounds effect 12 | - simple use 13 | - adjustable menu item height 14 | 15 | ## Installation 16 | 17 | Grab the files in `KOMenuView/` and put it in your project. 18 | 19 | ## Usage 20 | 21 | first, import `KOMenuView.h` 22 | ```objectivec 23 | _blurMenuView = [KOMenuView menuViewWithItem:@[@"Menu 01",@"Menu 02",@"Menu 03",@"Menu 04",@"Menu 05"] 24 | withPlaceView:self.view 25 | withClickByIndex:^(NSInteger itemIndex) { 26 | NSLog(@"itemIndex : %ld",(long)itemIndex); 27 | }]; 28 | ``` 29 | or you can custom menu item height 30 | ```objectivec 31 | _blurMenuView = [KOMenuView menuViewWithItem:@[@"Menu 01",@"Menu 02",@"Menu 03",@"Menu 04",@"Menu 05"] 32 | itemHeight:60.f 33 | withPlaceView:self.view 34 | withClickByIndex:^(NSInteger itemIndex) { 35 | NSLog(@"itemIndex : %ld",(long)itemIndex); 36 | }]; 37 | ``` 38 | you can set other funtion if you want 39 | ``` 40 | _blurMenuView.foldMenuWhenClickItem = YES; ///fold menu automatically when select item, default NO 41 | _blurMenuView.animaDuration = 0.3; ///animation duration, default 0.25 42 | ``` 43 | 44 | 45 | ### License 46 | 47 | `KOMenuView` is released under the MIT license. 48 | 49 | ### Author 50 | 51 | Kino 52 | 53 | `Email: 992276678@qq.com/ kinoandworld@gmail.com` 54 | 55 | `Weibo: http://weibo.com/u/1878504510` 56 | 57 | contact me if had any quetion . 58 | --------------------------------------------------------------------------------