├── .gitignore ├── DOPNavbarMenu ├── DOPNavbarMenu.h └── DOPNavbarMenu.m ├── DOPNavbarMenuDemo ├── DOPNavbarMenuDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── DOPNavbarMenuDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── DOPNavbarMenu │ │ ├── DOPNavbarMenu.h │ │ ├── DOPNavbarMenu.m │ │ ├── UIView+DOPExtension.h │ │ └── UIView+DOPExtension.m │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Image.imageset │ │ │ ├── Contents.json │ │ │ └── Development@2x.png │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m └── DOPNavbarMenuDemoTests │ ├── DOPNavbarMenuDemoTests.m │ └── Info.plist ├── Images └── sample.gif ├── 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 | -------------------------------------------------------------------------------- /DOPNavbarMenu/DOPNavbarMenu.h: -------------------------------------------------------------------------------- 1 | // 2 | // DOPNavbarMenu.h 3 | // DOPNavbarMenu 4 | // 5 | // Created by weizhou on 5/14/15. 6 | // Copyright (c) 2015 weizhou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DOPNavbarMenu : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DOPNavbarMenu/DOPNavbarMenu.m: -------------------------------------------------------------------------------- 1 | // 2 | // DOPNavbarMenu.m 3 | // DOPNavbarMenu 4 | // 5 | // Created by weizhou on 5/14/15. 6 | // Copyright (c) 2015 weizhou. All rights reserved. 7 | // 8 | 9 | #import "DOPNavbarMenu.h" 10 | 11 | @implementation DOPNavbarMenu 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 87435F4C1B04A932008138F0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 87435F4B1B04A932008138F0 /* main.m */; }; 11 | 87435F4F1B04A932008138F0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 87435F4E1B04A932008138F0 /* AppDelegate.m */; }; 12 | 87435F521B04A932008138F0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 87435F511B04A932008138F0 /* ViewController.m */; }; 13 | 87435F551B04A932008138F0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 87435F531B04A932008138F0 /* Main.storyboard */; }; 14 | 87435F571B04A932008138F0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 87435F561B04A932008138F0 /* Images.xcassets */; }; 15 | 87435F5A1B04A932008138F0 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 87435F581B04A932008138F0 /* LaunchScreen.xib */; }; 16 | 87435F661B04A932008138F0 /* DOPNavbarMenuDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 87435F651B04A932008138F0 /* DOPNavbarMenuDemoTests.m */; }; 17 | 87435F721B04A941008138F0 /* DOPNavbarMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 87435F711B04A941008138F0 /* DOPNavbarMenu.m */; }; 18 | 87435F751B04ABFE008138F0 /* UIView+DOPExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 87435F741B04ABFE008138F0 /* UIView+DOPExtension.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 87435F601B04A932008138F0 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 87435F3E1B04A932008138F0 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 87435F451B04A932008138F0; 27 | remoteInfo = DOPNavbarMenuDemo; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 87435F461B04A932008138F0 /* DOPNavbarMenuDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DOPNavbarMenuDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | 87435F4A1B04A932008138F0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | 87435F4B1B04A932008138F0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 35 | 87435F4D1B04A932008138F0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 36 | 87435F4E1B04A932008138F0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 37 | 87435F501B04A932008138F0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 38 | 87435F511B04A932008138F0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 39 | 87435F541B04A932008138F0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 40 | 87435F561B04A932008138F0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 41 | 87435F591B04A932008138F0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 42 | 87435F5F1B04A932008138F0 /* DOPNavbarMenuDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DOPNavbarMenuDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 87435F641B04A932008138F0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | 87435F651B04A932008138F0 /* DOPNavbarMenuDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DOPNavbarMenuDemoTests.m; sourceTree = ""; }; 45 | 87435F701B04A941008138F0 /* DOPNavbarMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOPNavbarMenu.h; sourceTree = ""; }; 46 | 87435F711B04A941008138F0 /* DOPNavbarMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DOPNavbarMenu.m; sourceTree = ""; }; 47 | 87435F731B04ABFE008138F0 /* UIView+DOPExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+DOPExtension.h"; sourceTree = ""; }; 48 | 87435F741B04ABFE008138F0 /* UIView+DOPExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+DOPExtension.m"; sourceTree = ""; }; 49 | /* End PBXFileReference section */ 50 | 51 | /* Begin PBXFrameworksBuildPhase section */ 52 | 87435F431B04A932008138F0 /* Frameworks */ = { 53 | isa = PBXFrameworksBuildPhase; 54 | buildActionMask = 2147483647; 55 | files = ( 56 | ); 57 | runOnlyForDeploymentPostprocessing = 0; 58 | }; 59 | 87435F5C1B04A932008138F0 /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXFrameworksBuildPhase section */ 67 | 68 | /* Begin PBXGroup section */ 69 | 87435F3D1B04A932008138F0 = { 70 | isa = PBXGroup; 71 | children = ( 72 | 87435F481B04A932008138F0 /* DOPNavbarMenuDemo */, 73 | 87435F621B04A932008138F0 /* DOPNavbarMenuDemoTests */, 74 | 87435F471B04A932008138F0 /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 87435F471B04A932008138F0 /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 87435F461B04A932008138F0 /* DOPNavbarMenuDemo.app */, 82 | 87435F5F1B04A932008138F0 /* DOPNavbarMenuDemoTests.xctest */, 83 | ); 84 | name = Products; 85 | sourceTree = ""; 86 | }; 87 | 87435F481B04A932008138F0 /* DOPNavbarMenuDemo */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 87435F6F1B04A941008138F0 /* DOPNavbarMenu */, 91 | 87435F4D1B04A932008138F0 /* AppDelegate.h */, 92 | 87435F4E1B04A932008138F0 /* AppDelegate.m */, 93 | 87435F501B04A932008138F0 /* ViewController.h */, 94 | 87435F511B04A932008138F0 /* ViewController.m */, 95 | 87435F531B04A932008138F0 /* Main.storyboard */, 96 | 87435F561B04A932008138F0 /* Images.xcassets */, 97 | 87435F581B04A932008138F0 /* LaunchScreen.xib */, 98 | 87435F491B04A932008138F0 /* Supporting Files */, 99 | ); 100 | path = DOPNavbarMenuDemo; 101 | sourceTree = ""; 102 | }; 103 | 87435F491B04A932008138F0 /* Supporting Files */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 87435F4A1B04A932008138F0 /* Info.plist */, 107 | 87435F4B1B04A932008138F0 /* main.m */, 108 | ); 109 | name = "Supporting Files"; 110 | sourceTree = ""; 111 | }; 112 | 87435F621B04A932008138F0 /* DOPNavbarMenuDemoTests */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 87435F651B04A932008138F0 /* DOPNavbarMenuDemoTests.m */, 116 | 87435F631B04A932008138F0 /* Supporting Files */, 117 | ); 118 | path = DOPNavbarMenuDemoTests; 119 | sourceTree = ""; 120 | }; 121 | 87435F631B04A932008138F0 /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 87435F641B04A932008138F0 /* Info.plist */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | 87435F6F1B04A941008138F0 /* DOPNavbarMenu */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 87435F701B04A941008138F0 /* DOPNavbarMenu.h */, 133 | 87435F711B04A941008138F0 /* DOPNavbarMenu.m */, 134 | 87435F731B04ABFE008138F0 /* UIView+DOPExtension.h */, 135 | 87435F741B04ABFE008138F0 /* UIView+DOPExtension.m */, 136 | ); 137 | path = DOPNavbarMenu; 138 | sourceTree = ""; 139 | }; 140 | /* End PBXGroup section */ 141 | 142 | /* Begin PBXNativeTarget section */ 143 | 87435F451B04A932008138F0 /* DOPNavbarMenuDemo */ = { 144 | isa = PBXNativeTarget; 145 | buildConfigurationList = 87435F691B04A932008138F0 /* Build configuration list for PBXNativeTarget "DOPNavbarMenuDemo" */; 146 | buildPhases = ( 147 | 87435F421B04A932008138F0 /* Sources */, 148 | 87435F431B04A932008138F0 /* Frameworks */, 149 | 87435F441B04A932008138F0 /* Resources */, 150 | ); 151 | buildRules = ( 152 | ); 153 | dependencies = ( 154 | ); 155 | name = DOPNavbarMenuDemo; 156 | productName = DOPNavbarMenuDemo; 157 | productReference = 87435F461B04A932008138F0 /* DOPNavbarMenuDemo.app */; 158 | productType = "com.apple.product-type.application"; 159 | }; 160 | 87435F5E1B04A932008138F0 /* DOPNavbarMenuDemoTests */ = { 161 | isa = PBXNativeTarget; 162 | buildConfigurationList = 87435F6C1B04A932008138F0 /* Build configuration list for PBXNativeTarget "DOPNavbarMenuDemoTests" */; 163 | buildPhases = ( 164 | 87435F5B1B04A932008138F0 /* Sources */, 165 | 87435F5C1B04A932008138F0 /* Frameworks */, 166 | 87435F5D1B04A932008138F0 /* Resources */, 167 | ); 168 | buildRules = ( 169 | ); 170 | dependencies = ( 171 | 87435F611B04A932008138F0 /* PBXTargetDependency */, 172 | ); 173 | name = DOPNavbarMenuDemoTests; 174 | productName = DOPNavbarMenuDemoTests; 175 | productReference = 87435F5F1B04A932008138F0 /* DOPNavbarMenuDemoTests.xctest */; 176 | productType = "com.apple.product-type.bundle.unit-test"; 177 | }; 178 | /* End PBXNativeTarget section */ 179 | 180 | /* Begin PBXProject section */ 181 | 87435F3E1B04A932008138F0 /* Project object */ = { 182 | isa = PBXProject; 183 | attributes = { 184 | LastUpgradeCheck = 0630; 185 | ORGANIZATIONNAME = weizhou; 186 | TargetAttributes = { 187 | 87435F451B04A932008138F0 = { 188 | CreatedOnToolsVersion = 6.3.1; 189 | }; 190 | 87435F5E1B04A932008138F0 = { 191 | CreatedOnToolsVersion = 6.3.1; 192 | TestTargetID = 87435F451B04A932008138F0; 193 | }; 194 | }; 195 | }; 196 | buildConfigurationList = 87435F411B04A932008138F0 /* Build configuration list for PBXProject "DOPNavbarMenuDemo" */; 197 | compatibilityVersion = "Xcode 3.2"; 198 | developmentRegion = English; 199 | hasScannedForEncodings = 0; 200 | knownRegions = ( 201 | en, 202 | Base, 203 | ); 204 | mainGroup = 87435F3D1B04A932008138F0; 205 | productRefGroup = 87435F471B04A932008138F0 /* Products */; 206 | projectDirPath = ""; 207 | projectRoot = ""; 208 | targets = ( 209 | 87435F451B04A932008138F0 /* DOPNavbarMenuDemo */, 210 | 87435F5E1B04A932008138F0 /* DOPNavbarMenuDemoTests */, 211 | ); 212 | }; 213 | /* End PBXProject section */ 214 | 215 | /* Begin PBXResourcesBuildPhase section */ 216 | 87435F441B04A932008138F0 /* Resources */ = { 217 | isa = PBXResourcesBuildPhase; 218 | buildActionMask = 2147483647; 219 | files = ( 220 | 87435F551B04A932008138F0 /* Main.storyboard in Resources */, 221 | 87435F5A1B04A932008138F0 /* LaunchScreen.xib in Resources */, 222 | 87435F571B04A932008138F0 /* Images.xcassets in Resources */, 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | 87435F5D1B04A932008138F0 /* Resources */ = { 227 | isa = PBXResourcesBuildPhase; 228 | buildActionMask = 2147483647; 229 | files = ( 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | /* End PBXResourcesBuildPhase section */ 234 | 235 | /* Begin PBXSourcesBuildPhase section */ 236 | 87435F421B04A932008138F0 /* Sources */ = { 237 | isa = PBXSourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | 87435F721B04A941008138F0 /* DOPNavbarMenu.m in Sources */, 241 | 87435F521B04A932008138F0 /* ViewController.m in Sources */, 242 | 87435F751B04ABFE008138F0 /* UIView+DOPExtension.m in Sources */, 243 | 87435F4F1B04A932008138F0 /* AppDelegate.m in Sources */, 244 | 87435F4C1B04A932008138F0 /* main.m in Sources */, 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | 87435F5B1B04A932008138F0 /* Sources */ = { 249 | isa = PBXSourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | 87435F661B04A932008138F0 /* DOPNavbarMenuDemoTests.m in Sources */, 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | }; 256 | /* End PBXSourcesBuildPhase section */ 257 | 258 | /* Begin PBXTargetDependency section */ 259 | 87435F611B04A932008138F0 /* PBXTargetDependency */ = { 260 | isa = PBXTargetDependency; 261 | target = 87435F451B04A932008138F0 /* DOPNavbarMenuDemo */; 262 | targetProxy = 87435F601B04A932008138F0 /* PBXContainerItemProxy */; 263 | }; 264 | /* End PBXTargetDependency section */ 265 | 266 | /* Begin PBXVariantGroup section */ 267 | 87435F531B04A932008138F0 /* Main.storyboard */ = { 268 | isa = PBXVariantGroup; 269 | children = ( 270 | 87435F541B04A932008138F0 /* Base */, 271 | ); 272 | name = Main.storyboard; 273 | sourceTree = ""; 274 | }; 275 | 87435F581B04A932008138F0 /* LaunchScreen.xib */ = { 276 | isa = PBXVariantGroup; 277 | children = ( 278 | 87435F591B04A932008138F0 /* Base */, 279 | ); 280 | name = LaunchScreen.xib; 281 | sourceTree = ""; 282 | }; 283 | /* End PBXVariantGroup section */ 284 | 285 | /* Begin XCBuildConfiguration section */ 286 | 87435F671B04A932008138F0 /* Debug */ = { 287 | isa = XCBuildConfiguration; 288 | buildSettings = { 289 | ALWAYS_SEARCH_USER_PATHS = NO; 290 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 291 | CLANG_CXX_LIBRARY = "libc++"; 292 | CLANG_ENABLE_MODULES = YES; 293 | CLANG_ENABLE_OBJC_ARC = YES; 294 | CLANG_WARN_BOOL_CONVERSION = YES; 295 | CLANG_WARN_CONSTANT_CONVERSION = YES; 296 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 297 | CLANG_WARN_EMPTY_BODY = YES; 298 | CLANG_WARN_ENUM_CONVERSION = YES; 299 | CLANG_WARN_INT_CONVERSION = YES; 300 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 301 | CLANG_WARN_UNREACHABLE_CODE = YES; 302 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 303 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 304 | COPY_PHASE_STRIP = NO; 305 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 306 | ENABLE_STRICT_OBJC_MSGSEND = YES; 307 | GCC_C_LANGUAGE_STANDARD = gnu99; 308 | GCC_DYNAMIC_NO_PIC = NO; 309 | GCC_NO_COMMON_BLOCKS = YES; 310 | GCC_OPTIMIZATION_LEVEL = 0; 311 | GCC_PREPROCESSOR_DEFINITIONS = ( 312 | "DEBUG=1", 313 | "$(inherited)", 314 | ); 315 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 316 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 317 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 318 | GCC_WARN_UNDECLARED_SELECTOR = YES; 319 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 320 | GCC_WARN_UNUSED_FUNCTION = YES; 321 | GCC_WARN_UNUSED_VARIABLE = YES; 322 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 323 | MTL_ENABLE_DEBUG_INFO = YES; 324 | ONLY_ACTIVE_ARCH = YES; 325 | SDKROOT = iphoneos; 326 | }; 327 | name = Debug; 328 | }; 329 | 87435F681B04A932008138F0 /* Release */ = { 330 | isa = XCBuildConfiguration; 331 | buildSettings = { 332 | ALWAYS_SEARCH_USER_PATHS = NO; 333 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 334 | CLANG_CXX_LIBRARY = "libc++"; 335 | CLANG_ENABLE_MODULES = YES; 336 | CLANG_ENABLE_OBJC_ARC = YES; 337 | CLANG_WARN_BOOL_CONVERSION = YES; 338 | CLANG_WARN_CONSTANT_CONVERSION = YES; 339 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 340 | CLANG_WARN_EMPTY_BODY = YES; 341 | CLANG_WARN_ENUM_CONVERSION = YES; 342 | CLANG_WARN_INT_CONVERSION = YES; 343 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 344 | CLANG_WARN_UNREACHABLE_CODE = YES; 345 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 346 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 347 | COPY_PHASE_STRIP = NO; 348 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 349 | ENABLE_NS_ASSERTIONS = NO; 350 | ENABLE_STRICT_OBJC_MSGSEND = YES; 351 | GCC_C_LANGUAGE_STANDARD = gnu99; 352 | GCC_NO_COMMON_BLOCKS = YES; 353 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 354 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 355 | GCC_WARN_UNDECLARED_SELECTOR = YES; 356 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 357 | GCC_WARN_UNUSED_FUNCTION = YES; 358 | GCC_WARN_UNUSED_VARIABLE = YES; 359 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 360 | MTL_ENABLE_DEBUG_INFO = NO; 361 | SDKROOT = iphoneos; 362 | VALIDATE_PRODUCT = YES; 363 | }; 364 | name = Release; 365 | }; 366 | 87435F6A1B04A932008138F0 /* Debug */ = { 367 | isa = XCBuildConfiguration; 368 | buildSettings = { 369 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 370 | INFOPLIST_FILE = DOPNavbarMenuDemo/Info.plist; 371 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 372 | PRODUCT_NAME = "$(TARGET_NAME)"; 373 | }; 374 | name = Debug; 375 | }; 376 | 87435F6B1B04A932008138F0 /* Release */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 380 | INFOPLIST_FILE = DOPNavbarMenuDemo/Info.plist; 381 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 382 | PRODUCT_NAME = "$(TARGET_NAME)"; 383 | }; 384 | name = Release; 385 | }; 386 | 87435F6D1B04A932008138F0 /* Debug */ = { 387 | isa = XCBuildConfiguration; 388 | buildSettings = { 389 | BUNDLE_LOADER = "$(TEST_HOST)"; 390 | FRAMEWORK_SEARCH_PATHS = ( 391 | "$(SDKROOT)/Developer/Library/Frameworks", 392 | "$(inherited)", 393 | ); 394 | GCC_PREPROCESSOR_DEFINITIONS = ( 395 | "DEBUG=1", 396 | "$(inherited)", 397 | ); 398 | INFOPLIST_FILE = DOPNavbarMenuDemoTests/Info.plist; 399 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 400 | PRODUCT_NAME = "$(TARGET_NAME)"; 401 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DOPNavbarMenuDemo.app/DOPNavbarMenuDemo"; 402 | }; 403 | name = Debug; 404 | }; 405 | 87435F6E1B04A932008138F0 /* Release */ = { 406 | isa = XCBuildConfiguration; 407 | buildSettings = { 408 | BUNDLE_LOADER = "$(TEST_HOST)"; 409 | FRAMEWORK_SEARCH_PATHS = ( 410 | "$(SDKROOT)/Developer/Library/Frameworks", 411 | "$(inherited)", 412 | ); 413 | INFOPLIST_FILE = DOPNavbarMenuDemoTests/Info.plist; 414 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 415 | PRODUCT_NAME = "$(TARGET_NAME)"; 416 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DOPNavbarMenuDemo.app/DOPNavbarMenuDemo"; 417 | }; 418 | name = Release; 419 | }; 420 | /* End XCBuildConfiguration section */ 421 | 422 | /* Begin XCConfigurationList section */ 423 | 87435F411B04A932008138F0 /* Build configuration list for PBXProject "DOPNavbarMenuDemo" */ = { 424 | isa = XCConfigurationList; 425 | buildConfigurations = ( 426 | 87435F671B04A932008138F0 /* Debug */, 427 | 87435F681B04A932008138F0 /* Release */, 428 | ); 429 | defaultConfigurationIsVisible = 0; 430 | defaultConfigurationName = Release; 431 | }; 432 | 87435F691B04A932008138F0 /* Build configuration list for PBXNativeTarget "DOPNavbarMenuDemo" */ = { 433 | isa = XCConfigurationList; 434 | buildConfigurations = ( 435 | 87435F6A1B04A932008138F0 /* Debug */, 436 | 87435F6B1B04A932008138F0 /* Release */, 437 | ); 438 | defaultConfigurationIsVisible = 0; 439 | }; 440 | 87435F6C1B04A932008138F0 /* Build configuration list for PBXNativeTarget "DOPNavbarMenuDemoTests" */ = { 441 | isa = XCConfigurationList; 442 | buildConfigurations = ( 443 | 87435F6D1B04A932008138F0 /* Debug */, 444 | 87435F6E1B04A932008138F0 /* Release */, 445 | ); 446 | defaultConfigurationIsVisible = 0; 447 | }; 448 | /* End XCConfigurationList section */ 449 | }; 450 | rootObject = 87435F3E1B04A932008138F0 /* Project object */; 451 | } 452 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DOPNavbarMenuDemo 4 | // 5 | // Created by weizhou on 5/14/15. 6 | // Copyright (c) 2015 weizhou. 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 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DOPNavbarMenuDemo 4 | // 5 | // Created by weizhou on 5/14/15. 6 | // Copyright (c) 2015 weizhou. 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 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/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 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 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 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/DOPNavbarMenu/DOPNavbarMenu.h: -------------------------------------------------------------------------------- 1 | // 2 | // DOPNavbarMenu.h 3 | // DOPNavbarMenu 4 | // 5 | // Created by weizhou on 5/14/15. 6 | // Copyright (c) 2015 weizhou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "UIView+DOPExtension.h" 12 | 13 | @interface UITouchGestureRecognizer : UIGestureRecognizer 14 | @end 15 | 16 | @interface DOPNavbarMenuItem : NSObject 17 | 18 | @property (copy, nonatomic, readonly) NSString *title; 19 | @property (strong, nonatomic, readonly) UIImage *icon; 20 | 21 | - (instancetype)initWithTitle:(NSString *)title icon:(UIImage *)icon; 22 | + (DOPNavbarMenuItem *)ItemWithTitle:(NSString *)title icon:(UIImage *)icon; 23 | 24 | @end 25 | 26 | @class DOPNavbarMenu; 27 | @protocol DOPNavbarMenuDelegate 28 | 29 | - (void)didShowMenu:(DOPNavbarMenu *)menu; 30 | - (void)didDismissMenu:(DOPNavbarMenu *)menu; 31 | - (void)didSelectedMenu:(DOPNavbarMenu *)menu atIndex:(NSInteger)index; 32 | 33 | @end 34 | 35 | //iOS7+ 36 | @interface DOPNavbarMenu : UIView 37 | 38 | @property (copy, nonatomic, readonly) NSArray *items; 39 | @property (assign, nonatomic, readonly) NSInteger maximumNumberInRow; 40 | @property (assign, nonatomic, getter=isOpen) BOOL open; 41 | @property (weak, nonatomic) id delegate; 42 | 43 | @property (strong, nonatomic) UIColor *textColor; 44 | @property (strong, nonatomic) UIColor *separatarColor; 45 | 46 | - (instancetype)initWithItems:(NSArray *)items 47 | width:(CGFloat)width 48 | maximumNumberInRow:(NSInteger)max; 49 | 50 | - (void)showInNavigationController:(UINavigationController *)nvc; 51 | - (void)dismissWithAnimation:(BOOL)animation; 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/DOPNavbarMenu/DOPNavbarMenu.m: -------------------------------------------------------------------------------- 1 | // 2 | // DOPNavbarMenu.m 3 | // DOPNavbarMenu 4 | // 5 | // Created by weizhou on 5/14/15. 6 | // Copyright (c) 2015 weizhou. All rights reserved. 7 | // 8 | 9 | #import "DOPNavbarMenu.h" 10 | 11 | @implementation UITouchGestureRecognizer 12 | 13 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 14 | [super touchesBegan:touches withEvent:event]; 15 | self.state = UIGestureRecognizerStateRecognized; 16 | } 17 | 18 | @end 19 | 20 | @implementation DOPNavbarMenuItem 21 | 22 | - (instancetype)initWithTitle:(NSString *)title icon:(UIImage *)icon { 23 | self = [super init]; 24 | if (self == nil) return nil; 25 | _title = title; 26 | _icon = icon; 27 | return self; 28 | } 29 | 30 | + (DOPNavbarMenuItem *)ItemWithTitle:(NSString *)title icon:(UIImage *)icon { 31 | return [[self alloc] initWithTitle:title icon:icon]; 32 | } 33 | 34 | @end 35 | 36 | static NSInteger rowHeight = 100; 37 | static CGFloat titleFontSize = 15.0; 38 | 39 | @interface DOPNavbarMenu () 40 | 41 | @property (strong, nonatomic) UIView *background; 42 | @property (assign, nonatomic) CGRect beforeAnimationFrame; 43 | @property (assign, nonatomic) CGRect afterAnimationFrame; 44 | @property (assign, nonatomic) NSInteger numberOfRow; 45 | 46 | @end 47 | 48 | @implementation DOPNavbarMenu 49 | 50 | - (instancetype)initWithItems:(NSArray *)items width:(CGFloat)width maximumNumberInRow:(NSInteger)max { 51 | self = [super initWithFrame:CGRectMake(0, 0, width, 0)]; 52 | if (self == nil) return nil; 53 | _items = items; 54 | _open = NO; 55 | _maximumNumberInRow = max; 56 | _numberOfRow = (_items.count-1)/_maximumNumberInRow + 1; 57 | self.dop_height = (_numberOfRow+1) * rowHeight; 58 | self.dop_y = -self.dop_height; 59 | _beforeAnimationFrame = self.frame; 60 | _afterAnimationFrame = self.frame; 61 | self.backgroundColor = [UIColor whiteColor]; 62 | _background = [[UIView alloc] initWithFrame:CGRectZero]; 63 | _background.backgroundColor = [UIColor clearColor]; 64 | UITouchGestureRecognizer *gr = [[UITouchGestureRecognizer alloc] initWithTarget:self action:@selector(dismissMenu)]; 65 | [_background addGestureRecognizer:gr]; 66 | _textColor = [UIColor whiteColor]; 67 | _separatarColor = [UIColor colorWithWhite:0.0 alpha:0.8]; 68 | return self; 69 | } 70 | 71 | - (void)layoutSubviews { 72 | [super layoutSubviews]; 73 | CGFloat buttonWidth = self.dop_width/self.maximumNumberInRow; 74 | CGFloat buttonHeight = rowHeight; 75 | [self.items enumerateObjectsUsingBlock:^(DOPNavbarMenuItem *obj, NSUInteger idx, BOOL *stop) { 76 | CGFloat buttonX = (idx % self.maximumNumberInRow) * buttonWidth; 77 | CGFloat buttonY = ((idx / self.maximumNumberInRow)+1) * buttonHeight; 78 | UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 79 | button.accessibilityLabel = obj.title; //for users of voiceOver 80 | button.frame = CGRectMake(buttonX, buttonY, buttonWidth, buttonHeight); 81 | button.tag = idx; 82 | [self addSubview:button]; 83 | [button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside]; 84 | UIImageView *icon = [[UIImageView alloc] initWithImage:obj.icon]; 85 | icon.center = CGPointMake(buttonWidth/2, buttonHeight/2-15); 86 | [button addSubview:icon]; 87 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, buttonHeight-35, buttonWidth, 20)]; 88 | label.text = obj.title; 89 | label.textAlignment = NSTextAlignmentCenter; 90 | label.textColor = self.textColor; 91 | label.font = [UIFont systemFontOfSize:titleFontSize]; 92 | [button addSubview:label]; 93 | if ((idx+1)%self.maximumNumberInRow != 0) { 94 | UIView *separatar = [[UIView alloc] initWithFrame:CGRectMake(buttonWidth-0.5, 0, 0.5, buttonHeight)]; 95 | separatar.backgroundColor = self.separatarColor; 96 | [button addSubview:separatar]; 97 | } 98 | if (self.numberOfRow > 1 && idx/self.maximumNumberInRow < (self.numberOfRow-1)) { 99 | UIView *separatar = [[UIView alloc] initWithFrame:CGRectMake(0, buttonHeight-0.5, buttonWidth, 0.5)]; 100 | separatar.backgroundColor = self.separatarColor; 101 | [button addSubview:separatar]; 102 | } 103 | }]; 104 | } 105 | 106 | - (void)showInNavigationController:(UINavigationController *)nvc { 107 | [nvc.view insertSubview:self.background belowSubview:nvc.navigationBar]; 108 | [nvc.view insertSubview:self belowSubview:nvc.navigationBar]; 109 | if (CGRectEqualToRect(self.beforeAnimationFrame, self.afterAnimationFrame)) { 110 | CGRect tmp = self.afterAnimationFrame; 111 | tmp.origin.y += ([UIApplication sharedApplication].statusBarFrame.size.height+nvc.navigationBar.dop_height+rowHeight*self.numberOfRow); 112 | self.afterAnimationFrame = tmp; 113 | } 114 | self.background.frame = nvc.view.frame; 115 | [UIView animateWithDuration:0.5 116 | delay:0.0 117 | usingSpringWithDamping:0.6 118 | initialSpringVelocity:1.0 119 | options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut 120 | animations:^{ 121 | self.dop_y = self.afterAnimationFrame.origin.y; 122 | } completion:^(BOOL finished) { 123 | if (self.delegate != nil) { 124 | [self.delegate didShowMenu:self]; 125 | } 126 | self.open = YES; 127 | }]; 128 | } 129 | 130 | - (void)dismissWithAnimation:(BOOL)animation { 131 | void (^completion)(void) = ^void(void) { 132 | [self removeFromSuperview]; 133 | [self.background removeFromSuperview]; 134 | if (self.delegate != nil) { 135 | [self.delegate didDismissMenu:self]; 136 | } 137 | self.open = NO; 138 | }; 139 | if (animation) { 140 | [UIView animateWithDuration:0.2 animations:^{ 141 | self.dop_y += 20; 142 | } completion:^(BOOL finished) { 143 | [UIView animateWithDuration:0.1 animations:^{ 144 | self.dop_y = self.beforeAnimationFrame.origin.y; 145 | } completion:^(BOOL finished) { 146 | completion(); 147 | }]; 148 | }]; 149 | } else { 150 | self.dop_y = self.beforeAnimationFrame.origin.y; 151 | completion(); 152 | } 153 | } 154 | 155 | - (void)dismissMenu { 156 | [self dismissWithAnimation:YES]; 157 | } 158 | 159 | - (void)buttonTapped:(UIButton *)button { 160 | if (self.delegate) { 161 | [self.delegate didSelectedMenu:self atIndex:button.tag]; 162 | } 163 | [self dismissMenu]; 164 | } 165 | @end 166 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/DOPNavbarMenu/UIView+DOPExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+DOPExtension.h 3 | // DOPExtensionNavbarMenuDemo 4 | // 5 | // Created by weizhou on 5/14/15. 6 | // Copyright (c) 2015 weizhou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (DOPExtension) 12 | 13 | @property (assign, nonatomic) CGFloat dop_x; 14 | @property (assign, nonatomic) CGFloat dop_y; 15 | @property (assign, nonatomic) CGFloat dop_width; 16 | @property (assign, nonatomic) CGFloat dop_height; 17 | @property (assign, nonatomic) CGSize dop_size; 18 | @property (assign, nonatomic) CGPoint dop_origin; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/DOPNavbarMenu/UIView+DOPExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+DOPExtension.m 3 | // DOPExtensionNavbarMenuDemo 4 | // 5 | // Created by weizhou on 5/14/15. 6 | // Copyright (c) 2015 weizhou. All rights reserved. 7 | // 8 | 9 | #import "UIView+DOPExtension.h" 10 | 11 | @implementation UIView (DOPExtension) 12 | 13 | - (void)setDop_x:(CGFloat)dop_x { 14 | CGRect frame = self.frame; 15 | frame.origin.x = dop_x; 16 | self.frame = frame; 17 | } 18 | 19 | - (CGFloat)dop_x { 20 | return self.frame.origin.x; 21 | } 22 | 23 | - (void)setDop_y:(CGFloat)dop_y { 24 | CGRect frame = self.frame; 25 | frame.origin.y = dop_y; 26 | self.frame = frame; 27 | } 28 | 29 | - (CGFloat)dop_y { 30 | return self.frame.origin.y; 31 | } 32 | 33 | - (void)setDop_width:(CGFloat)dop_width { 34 | CGRect frame = self.frame; 35 | frame.size.width = dop_width; 36 | self.frame = frame; 37 | } 38 | 39 | - (CGFloat)dop_width { 40 | return self.frame.size.width; 41 | } 42 | 43 | - (void)setDop_height:(CGFloat)dop_height { 44 | CGRect frame = self.frame; 45 | frame.size.height = dop_height; 46 | self.frame = frame; 47 | } 48 | 49 | - (CGFloat)dop_height { 50 | return self.frame.size.height; 51 | } 52 | 53 | - (void)setDop_size:(CGSize)dop_size { 54 | CGRect frame = self.frame; 55 | frame.size = dop_size; 56 | self.frame = frame; 57 | } 58 | 59 | - (CGSize)dop_size { 60 | return self.frame.size; 61 | } 62 | 63 | - (void)setDop_origin:(CGPoint)dop_origin { 64 | CGRect frame = self.frame; 65 | frame.origin = dop_origin; 66 | self.frame = frame; 67 | } 68 | 69 | - (CGPoint)dop_origin { 70 | return self.frame.origin; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/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 | } -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/Images.xcassets/Image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "Development@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/Images.xcassets/Image.imageset/Development@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dopcn/DOPNavbarMenu/5e8a2525ba578b80b0d122f89da753b7ceb6d3d8/DOPNavbarMenuDemo/DOPNavbarMenuDemo/Images.xcassets/Image.imageset/Development@2x.png -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | weizhou.$(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 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // DOPNavbarMenuDemo 4 | // 5 | // Created by weizhou on 5/14/15. 6 | // Copyright (c) 2015 weizhou. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // DOPNavbarMenuDemo 4 | // 5 | // Created by weizhou on 5/14/15. 6 | // Copyright (c) 2015 weizhou. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "DOPNavbarMenu.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (assign, nonatomic) NSInteger numberOfItemsInRow; 15 | @property (strong, nonatomic) DOPNavbarMenu *menu; 16 | 17 | @end 18 | 19 | @implementation ViewController 20 | 21 | - (DOPNavbarMenu *)menu { 22 | if (_menu == nil) { 23 | DOPNavbarMenuItem *item1 = [DOPNavbarMenuItem ItemWithTitle:@"item" icon:[UIImage imageNamed:@"Image"]]; 24 | _menu = [[DOPNavbarMenu alloc] initWithItems:@[item1,item1,item1,item1,item1,item1] width:self.view.dop_width maximumNumberInRow:_numberOfItemsInRow]; 25 | _menu.backgroundColor = [UIColor blackColor]; 26 | _menu.separatarColor = [UIColor whiteColor]; 27 | _menu.delegate = self; 28 | } 29 | return _menu; 30 | } 31 | 32 | - (void)viewDidLoad { 33 | [super viewDidLoad]; 34 | self.numberOfItemsInRow = 3; 35 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"menu" style:UIBarButtonItemStylePlain target:self action:@selector(openMenu:)]; 36 | self.navigationItem.rightBarButtonItem.tintColor = [UIColor whiteColor]; 37 | } 38 | 39 | - (void)viewWillDisappear:(BOOL)animated { 40 | [super viewWillDisappear:animated]; 41 | if (self.menu) { 42 | [self.menu dismissWithAnimation:NO]; 43 | } 44 | } 45 | 46 | - (void)openMenu:(id)sender { 47 | self.navigationItem.rightBarButtonItem.enabled = NO; 48 | if (self.menu.isOpen) { 49 | [self.menu dismissWithAnimation:YES]; 50 | } else { 51 | [self.menu showInNavigationController:self.navigationController]; 52 | } 53 | } 54 | 55 | - (void)didShowMenu:(DOPNavbarMenu *)menu { 56 | [self.navigationItem.rightBarButtonItem setTitle:@"dismiss"]; 57 | self.navigationItem.rightBarButtonItem.enabled = YES; 58 | } 59 | 60 | - (void)didDismissMenu:(DOPNavbarMenu *)menu { 61 | [self.navigationItem.rightBarButtonItem setTitle:@"menu"]; 62 | self.navigationItem.rightBarButtonItem.enabled = YES; 63 | } 64 | 65 | - (void)didSelectedMenu:(DOPNavbarMenu *)menu atIndex:(NSInteger)index { 66 | UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"you selected" message:[NSString stringWithFormat:@"number %@", @(index+1)] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; 67 | [av show]; 68 | } 69 | 70 | - (void)didReceiveMemoryWarning { 71 | [super didReceiveMemoryWarning]; 72 | // Dispose of any resources that can be recreated. 73 | } 74 | 75 | - (UIStatusBarStyle)preferredStatusBarStyle { 76 | return UIStatusBarStyleLightContent; 77 | } 78 | 79 | - (void)textViewDidChange:(UITextView *)textView { 80 | self.numberOfItemsInRow = [textView.text integerValue]; 81 | self.menu = nil; 82 | } 83 | 84 | - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { 85 | self.menu = nil; 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DOPNavbarMenuDemo 4 | // 5 | // Created by weizhou on 5/14/15. 6 | // Copyright (c) 2015 weizhou. 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 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemoTests/DOPNavbarMenuDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // DOPNavbarMenuDemoTests.m 3 | // DOPNavbarMenuDemoTests 4 | // 5 | // Created by weizhou on 5/14/15. 6 | // Copyright (c) 2015 weizhou. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface DOPNavbarMenuDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation DOPNavbarMenuDemoTests 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 | -------------------------------------------------------------------------------- /DOPNavbarMenuDemo/DOPNavbarMenuDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | weizhou.$(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 | -------------------------------------------------------------------------------- /Images/sample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dopcn/DOPNavbarMenu/5e8a2525ba578b80b0d122f89da753b7ceb6d3d8/Images/sample.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Weizhou 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 | # DOPNavbarMenu 2 | expand navigationbar with more items 3 | 4 | gif better than any words. 5 | 6 | ![image](https://github.com/dopcn/DOPNavbarMenu/blob/master/Images/sample.gif) 7 | 8 | ### `@interface` 9 | ```objc 10 | 11 | //iOS7+ 12 | @interface DOPNavbarMenu : UIView 13 | 14 | @property (copy, nonatomic, readonly) NSArray *items; 15 | @property (assign, nonatomic, readonly) NSInteger maximumNumberInRow; 16 | @property (assign, nonatomic, getter=isOpen) BOOL open; 17 | @property (weak, nonatomic) id delegate; 18 | 19 | @property (strong, nonatomic) UIColor *textColor; 20 | @property (strong, nonatomic) UIColor *separatarColor; 21 | 22 | - (instancetype)initWithItems:(NSArray *)items 23 | width:(CGFloat)width 24 | maximumNumberInRow:(NSInteger)max; 25 | 26 | - (void)showInNavigationController:(UINavigationController *)nvc; 27 | - (void)dismissWithAnimation:(BOOL)animation; 28 | 29 | @end 30 | ``` 31 | 32 | ### `@protocol` 33 | 34 | ```objc 35 | @protocol DOPNavbarMenuDelegate 36 | 37 | - (void)didShowMenu:(DOPNavbarMenu *)menu; 38 | - (void)didDismissMenu:(DOPNavbarMenu *)menu; 39 | - (void)didSelectedMenu:(DOPNavbarMenu *)menu atIndex:(NSInteger)index; 40 | 41 | @end 42 | ``` --------------------------------------------------------------------------------