├── .gitignore ├── JMDropMenu.podspec ├── JMDropMenu.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── JMDropMenu ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── img1.imageset │ │ ├── Contents.json │ │ └── img1.png │ ├── img2.imageset │ │ ├── Contents.json │ │ └── img2.png │ ├── img3.imageset │ │ ├── Contents.json │ │ └── img3.png │ ├── img4.imageset │ │ ├── Contents.json │ │ └── img4.png │ └── img5.imageset │ │ ├── Contents.json │ │ └── img5.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── JMDropMenu.gif ├── JMDropMenu │ ├── JMDropMenu.h │ └── JMDropMenu.m ├── ViewController.h ├── ViewController.m └── main.m ├── JMDropMenuTests ├── Info.plist └── JMDropMenuTests.m ├── JMDropMenuUITests ├── Info.plist └── JMDropMenuUITests.m ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /JMDropMenu.podspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pod::Spec.new do |s| 4 | 5 | s.name = "JMDropMenu" 6 | s.version = "0.1.1" 7 | s.summary = "仿QQ、微信下拉菜单封装, 一行代码调用" 8 | 9 | s.description = <<-DESC 10 | 仿QQ、微信下拉菜单封装, 一行代码调用 11 | DESC 12 | 13 | s.homepage = "https://github.com/JunAILiang/JMDropMenu" 14 | 15 | s.license = "MIT" 16 | 17 | s.author = { "LJM" => "gzliujm@163.com" } 18 | 19 | s.platform = :ios, "8.0" 20 | 21 | s.source = { :git => "https://github.com/JunAILiang/JMDropMenu.git", :tag => "#{s.version}" } 22 | 23 | s.source_files = "JMDropMenu/JMDropMenu/**/*.{h,m}" 24 | 25 | s.requires_arc = true 26 | 27 | end 28 | -------------------------------------------------------------------------------- /JMDropMenu.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | CBD460951FEA5E0A00BE35C3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CBD460941FEA5E0A00BE35C3 /* AppDelegate.m */; }; 11 | CBD460981FEA5E0A00BE35C3 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CBD460971FEA5E0A00BE35C3 /* ViewController.m */; }; 12 | CBD4609B1FEA5E0A00BE35C3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CBD460991FEA5E0A00BE35C3 /* Main.storyboard */; }; 13 | CBD4609D1FEA5E0A00BE35C3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CBD4609C1FEA5E0A00BE35C3 /* Assets.xcassets */; }; 14 | CBD460A01FEA5E0A00BE35C3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CBD4609E1FEA5E0A00BE35C3 /* LaunchScreen.storyboard */; }; 15 | CBD460A31FEA5E0A00BE35C3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CBD460A21FEA5E0A00BE35C3 /* main.m */; }; 16 | CBD460AD1FEA5E0A00BE35C3 /* JMDropMenuTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CBD460AC1FEA5E0A00BE35C3 /* JMDropMenuTests.m */; }; 17 | CBD460B81FEA5E0A00BE35C3 /* JMDropMenuUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = CBD460B71FEA5E0A00BE35C3 /* JMDropMenuUITests.m */; }; 18 | CBD460C81FEA5E6C00BE35C3 /* JMDropMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = CBD460C71FEA5E6C00BE35C3 /* JMDropMenu.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | CBD460A91FEA5E0A00BE35C3 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = CBD460881FEA5E0900BE35C3 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = CBD4608F1FEA5E0900BE35C3; 27 | remoteInfo = JMDropMenu; 28 | }; 29 | CBD460B41FEA5E0A00BE35C3 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = CBD460881FEA5E0900BE35C3 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = CBD4608F1FEA5E0900BE35C3; 34 | remoteInfo = JMDropMenu; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | CBD460901FEA5E0900BE35C3 /* JMDropMenu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JMDropMenu.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | CBD460931FEA5E0A00BE35C3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 41 | CBD460941FEA5E0A00BE35C3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 42 | CBD460961FEA5E0A00BE35C3 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 43 | CBD460971FEA5E0A00BE35C3 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 44 | CBD4609A1FEA5E0A00BE35C3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | CBD4609C1FEA5E0A00BE35C3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 46 | CBD4609F1FEA5E0A00BE35C3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 47 | CBD460A11FEA5E0A00BE35C3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | CBD460A21FEA5E0A00BE35C3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 49 | CBD460A81FEA5E0A00BE35C3 /* JMDropMenuTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JMDropMenuTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | CBD460AC1FEA5E0A00BE35C3 /* JMDropMenuTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JMDropMenuTests.m; sourceTree = ""; }; 51 | CBD460AE1FEA5E0A00BE35C3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | CBD460B31FEA5E0A00BE35C3 /* JMDropMenuUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JMDropMenuUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | CBD460B71FEA5E0A00BE35C3 /* JMDropMenuUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JMDropMenuUITests.m; sourceTree = ""; }; 54 | CBD460B91FEA5E0A00BE35C3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | CBD460C61FEA5E6C00BE35C3 /* JMDropMenu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JMDropMenu.h; sourceTree = ""; }; 56 | CBD460C71FEA5E6C00BE35C3 /* JMDropMenu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JMDropMenu.m; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | CBD4608D1FEA5E0900BE35C3 /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | CBD460A51FEA5E0A00BE35C3 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | CBD460B01FEA5E0A00BE35C3 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | CBD460871FEA5E0900BE35C3 = { 85 | isa = PBXGroup; 86 | children = ( 87 | CBD460921FEA5E0900BE35C3 /* JMDropMenu */, 88 | CBD460AB1FEA5E0A00BE35C3 /* JMDropMenuTests */, 89 | CBD460B61FEA5E0A00BE35C3 /* JMDropMenuUITests */, 90 | CBD460911FEA5E0900BE35C3 /* Products */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | CBD460911FEA5E0900BE35C3 /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | CBD460901FEA5E0900BE35C3 /* JMDropMenu.app */, 98 | CBD460A81FEA5E0A00BE35C3 /* JMDropMenuTests.xctest */, 99 | CBD460B31FEA5E0A00BE35C3 /* JMDropMenuUITests.xctest */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | CBD460921FEA5E0900BE35C3 /* JMDropMenu */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | CBD460C51FEA5E5E00BE35C3 /* JMDropMenu */, 108 | CBD460931FEA5E0A00BE35C3 /* AppDelegate.h */, 109 | CBD460941FEA5E0A00BE35C3 /* AppDelegate.m */, 110 | CBD460961FEA5E0A00BE35C3 /* ViewController.h */, 111 | CBD460971FEA5E0A00BE35C3 /* ViewController.m */, 112 | CBD460991FEA5E0A00BE35C3 /* Main.storyboard */, 113 | CBD4609C1FEA5E0A00BE35C3 /* Assets.xcassets */, 114 | CBD4609E1FEA5E0A00BE35C3 /* LaunchScreen.storyboard */, 115 | CBD460A11FEA5E0A00BE35C3 /* Info.plist */, 116 | CBD460A21FEA5E0A00BE35C3 /* main.m */, 117 | ); 118 | path = JMDropMenu; 119 | sourceTree = ""; 120 | }; 121 | CBD460AB1FEA5E0A00BE35C3 /* JMDropMenuTests */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | CBD460AC1FEA5E0A00BE35C3 /* JMDropMenuTests.m */, 125 | CBD460AE1FEA5E0A00BE35C3 /* Info.plist */, 126 | ); 127 | path = JMDropMenuTests; 128 | sourceTree = ""; 129 | }; 130 | CBD460B61FEA5E0A00BE35C3 /* JMDropMenuUITests */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | CBD460B71FEA5E0A00BE35C3 /* JMDropMenuUITests.m */, 134 | CBD460B91FEA5E0A00BE35C3 /* Info.plist */, 135 | ); 136 | path = JMDropMenuUITests; 137 | sourceTree = ""; 138 | }; 139 | CBD460C51FEA5E5E00BE35C3 /* JMDropMenu */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | CBD460C61FEA5E6C00BE35C3 /* JMDropMenu.h */, 143 | CBD460C71FEA5E6C00BE35C3 /* JMDropMenu.m */, 144 | ); 145 | path = JMDropMenu; 146 | sourceTree = ""; 147 | }; 148 | /* End PBXGroup section */ 149 | 150 | /* Begin PBXNativeTarget section */ 151 | CBD4608F1FEA5E0900BE35C3 /* JMDropMenu */ = { 152 | isa = PBXNativeTarget; 153 | buildConfigurationList = CBD460BC1FEA5E0A00BE35C3 /* Build configuration list for PBXNativeTarget "JMDropMenu" */; 154 | buildPhases = ( 155 | CBD4608C1FEA5E0900BE35C3 /* Sources */, 156 | CBD4608D1FEA5E0900BE35C3 /* Frameworks */, 157 | CBD4608E1FEA5E0900BE35C3 /* Resources */, 158 | ); 159 | buildRules = ( 160 | ); 161 | dependencies = ( 162 | ); 163 | name = JMDropMenu; 164 | productName = JMDropMenu; 165 | productReference = CBD460901FEA5E0900BE35C3 /* JMDropMenu.app */; 166 | productType = "com.apple.product-type.application"; 167 | }; 168 | CBD460A71FEA5E0A00BE35C3 /* JMDropMenuTests */ = { 169 | isa = PBXNativeTarget; 170 | buildConfigurationList = CBD460BF1FEA5E0A00BE35C3 /* Build configuration list for PBXNativeTarget "JMDropMenuTests" */; 171 | buildPhases = ( 172 | CBD460A41FEA5E0A00BE35C3 /* Sources */, 173 | CBD460A51FEA5E0A00BE35C3 /* Frameworks */, 174 | CBD460A61FEA5E0A00BE35C3 /* Resources */, 175 | ); 176 | buildRules = ( 177 | ); 178 | dependencies = ( 179 | CBD460AA1FEA5E0A00BE35C3 /* PBXTargetDependency */, 180 | ); 181 | name = JMDropMenuTests; 182 | productName = JMDropMenuTests; 183 | productReference = CBD460A81FEA5E0A00BE35C3 /* JMDropMenuTests.xctest */; 184 | productType = "com.apple.product-type.bundle.unit-test"; 185 | }; 186 | CBD460B21FEA5E0A00BE35C3 /* JMDropMenuUITests */ = { 187 | isa = PBXNativeTarget; 188 | buildConfigurationList = CBD460C21FEA5E0A00BE35C3 /* Build configuration list for PBXNativeTarget "JMDropMenuUITests" */; 189 | buildPhases = ( 190 | CBD460AF1FEA5E0A00BE35C3 /* Sources */, 191 | CBD460B01FEA5E0A00BE35C3 /* Frameworks */, 192 | CBD460B11FEA5E0A00BE35C3 /* Resources */, 193 | ); 194 | buildRules = ( 195 | ); 196 | dependencies = ( 197 | CBD460B51FEA5E0A00BE35C3 /* PBXTargetDependency */, 198 | ); 199 | name = JMDropMenuUITests; 200 | productName = JMDropMenuUITests; 201 | productReference = CBD460B31FEA5E0A00BE35C3 /* JMDropMenuUITests.xctest */; 202 | productType = "com.apple.product-type.bundle.ui-testing"; 203 | }; 204 | /* End PBXNativeTarget section */ 205 | 206 | /* Begin PBXProject section */ 207 | CBD460881FEA5E0900BE35C3 /* Project object */ = { 208 | isa = PBXProject; 209 | attributes = { 210 | LastUpgradeCheck = 0910; 211 | ORGANIZATIONNAME = JM; 212 | TargetAttributes = { 213 | CBD4608F1FEA5E0900BE35C3 = { 214 | CreatedOnToolsVersion = 9.1; 215 | ProvisioningStyle = Automatic; 216 | }; 217 | CBD460A71FEA5E0A00BE35C3 = { 218 | CreatedOnToolsVersion = 9.1; 219 | ProvisioningStyle = Automatic; 220 | TestTargetID = CBD4608F1FEA5E0900BE35C3; 221 | }; 222 | CBD460B21FEA5E0A00BE35C3 = { 223 | CreatedOnToolsVersion = 9.1; 224 | ProvisioningStyle = Automatic; 225 | TestTargetID = CBD4608F1FEA5E0900BE35C3; 226 | }; 227 | }; 228 | }; 229 | buildConfigurationList = CBD4608B1FEA5E0900BE35C3 /* Build configuration list for PBXProject "JMDropMenu" */; 230 | compatibilityVersion = "Xcode 8.0"; 231 | developmentRegion = en; 232 | hasScannedForEncodings = 0; 233 | knownRegions = ( 234 | en, 235 | Base, 236 | ); 237 | mainGroup = CBD460871FEA5E0900BE35C3; 238 | productRefGroup = CBD460911FEA5E0900BE35C3 /* Products */; 239 | projectDirPath = ""; 240 | projectRoot = ""; 241 | targets = ( 242 | CBD4608F1FEA5E0900BE35C3 /* JMDropMenu */, 243 | CBD460A71FEA5E0A00BE35C3 /* JMDropMenuTests */, 244 | CBD460B21FEA5E0A00BE35C3 /* JMDropMenuUITests */, 245 | ); 246 | }; 247 | /* End PBXProject section */ 248 | 249 | /* Begin PBXResourcesBuildPhase section */ 250 | CBD4608E1FEA5E0900BE35C3 /* Resources */ = { 251 | isa = PBXResourcesBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | CBD460A01FEA5E0A00BE35C3 /* LaunchScreen.storyboard in Resources */, 255 | CBD4609D1FEA5E0A00BE35C3 /* Assets.xcassets in Resources */, 256 | CBD4609B1FEA5E0A00BE35C3 /* Main.storyboard in Resources */, 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | }; 260 | CBD460A61FEA5E0A00BE35C3 /* Resources */ = { 261 | isa = PBXResourcesBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | }; 267 | CBD460B11FEA5E0A00BE35C3 /* Resources */ = { 268 | isa = PBXResourcesBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | ); 272 | runOnlyForDeploymentPostprocessing = 0; 273 | }; 274 | /* End PBXResourcesBuildPhase section */ 275 | 276 | /* Begin PBXSourcesBuildPhase section */ 277 | CBD4608C1FEA5E0900BE35C3 /* Sources */ = { 278 | isa = PBXSourcesBuildPhase; 279 | buildActionMask = 2147483647; 280 | files = ( 281 | CBD460C81FEA5E6C00BE35C3 /* JMDropMenu.m in Sources */, 282 | CBD460981FEA5E0A00BE35C3 /* ViewController.m in Sources */, 283 | CBD460A31FEA5E0A00BE35C3 /* main.m in Sources */, 284 | CBD460951FEA5E0A00BE35C3 /* AppDelegate.m in Sources */, 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | }; 288 | CBD460A41FEA5E0A00BE35C3 /* Sources */ = { 289 | isa = PBXSourcesBuildPhase; 290 | buildActionMask = 2147483647; 291 | files = ( 292 | CBD460AD1FEA5E0A00BE35C3 /* JMDropMenuTests.m in Sources */, 293 | ); 294 | runOnlyForDeploymentPostprocessing = 0; 295 | }; 296 | CBD460AF1FEA5E0A00BE35C3 /* Sources */ = { 297 | isa = PBXSourcesBuildPhase; 298 | buildActionMask = 2147483647; 299 | files = ( 300 | CBD460B81FEA5E0A00BE35C3 /* JMDropMenuUITests.m in Sources */, 301 | ); 302 | runOnlyForDeploymentPostprocessing = 0; 303 | }; 304 | /* End PBXSourcesBuildPhase section */ 305 | 306 | /* Begin PBXTargetDependency section */ 307 | CBD460AA1FEA5E0A00BE35C3 /* PBXTargetDependency */ = { 308 | isa = PBXTargetDependency; 309 | target = CBD4608F1FEA5E0900BE35C3 /* JMDropMenu */; 310 | targetProxy = CBD460A91FEA5E0A00BE35C3 /* PBXContainerItemProxy */; 311 | }; 312 | CBD460B51FEA5E0A00BE35C3 /* PBXTargetDependency */ = { 313 | isa = PBXTargetDependency; 314 | target = CBD4608F1FEA5E0900BE35C3 /* JMDropMenu */; 315 | targetProxy = CBD460B41FEA5E0A00BE35C3 /* PBXContainerItemProxy */; 316 | }; 317 | /* End PBXTargetDependency section */ 318 | 319 | /* Begin PBXVariantGroup section */ 320 | CBD460991FEA5E0A00BE35C3 /* Main.storyboard */ = { 321 | isa = PBXVariantGroup; 322 | children = ( 323 | CBD4609A1FEA5E0A00BE35C3 /* Base */, 324 | ); 325 | name = Main.storyboard; 326 | sourceTree = ""; 327 | }; 328 | CBD4609E1FEA5E0A00BE35C3 /* LaunchScreen.storyboard */ = { 329 | isa = PBXVariantGroup; 330 | children = ( 331 | CBD4609F1FEA5E0A00BE35C3 /* Base */, 332 | ); 333 | name = LaunchScreen.storyboard; 334 | sourceTree = ""; 335 | }; 336 | /* End PBXVariantGroup section */ 337 | 338 | /* Begin XCBuildConfiguration section */ 339 | CBD460BA1FEA5E0A00BE35C3 /* Debug */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ALWAYS_SEARCH_USER_PATHS = NO; 343 | CLANG_ANALYZER_NONNULL = YES; 344 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 345 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 346 | CLANG_CXX_LIBRARY = "libc++"; 347 | CLANG_ENABLE_MODULES = YES; 348 | CLANG_ENABLE_OBJC_ARC = YES; 349 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 350 | CLANG_WARN_BOOL_CONVERSION = YES; 351 | CLANG_WARN_COMMA = YES; 352 | CLANG_WARN_CONSTANT_CONVERSION = YES; 353 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 354 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 355 | CLANG_WARN_EMPTY_BODY = YES; 356 | CLANG_WARN_ENUM_CONVERSION = YES; 357 | CLANG_WARN_INFINITE_RECURSION = YES; 358 | CLANG_WARN_INT_CONVERSION = YES; 359 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 360 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 361 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 362 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 363 | CLANG_WARN_STRICT_PROTOTYPES = YES; 364 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 365 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 366 | CLANG_WARN_UNREACHABLE_CODE = YES; 367 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 368 | CODE_SIGN_IDENTITY = "iPhone Developer"; 369 | COPY_PHASE_STRIP = NO; 370 | DEBUG_INFORMATION_FORMAT = dwarf; 371 | ENABLE_STRICT_OBJC_MSGSEND = YES; 372 | ENABLE_TESTABILITY = YES; 373 | GCC_C_LANGUAGE_STANDARD = gnu11; 374 | GCC_DYNAMIC_NO_PIC = NO; 375 | GCC_NO_COMMON_BLOCKS = YES; 376 | GCC_OPTIMIZATION_LEVEL = 0; 377 | GCC_PREPROCESSOR_DEFINITIONS = ( 378 | "DEBUG=1", 379 | "$(inherited)", 380 | ); 381 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 382 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 383 | GCC_WARN_UNDECLARED_SELECTOR = YES; 384 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 385 | GCC_WARN_UNUSED_FUNCTION = YES; 386 | GCC_WARN_UNUSED_VARIABLE = YES; 387 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 388 | MTL_ENABLE_DEBUG_INFO = YES; 389 | ONLY_ACTIVE_ARCH = YES; 390 | SDKROOT = iphoneos; 391 | }; 392 | name = Debug; 393 | }; 394 | CBD460BB1FEA5E0A00BE35C3 /* Release */ = { 395 | isa = XCBuildConfiguration; 396 | buildSettings = { 397 | ALWAYS_SEARCH_USER_PATHS = NO; 398 | CLANG_ANALYZER_NONNULL = YES; 399 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 400 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 401 | CLANG_CXX_LIBRARY = "libc++"; 402 | CLANG_ENABLE_MODULES = YES; 403 | CLANG_ENABLE_OBJC_ARC = YES; 404 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 405 | CLANG_WARN_BOOL_CONVERSION = YES; 406 | CLANG_WARN_COMMA = YES; 407 | CLANG_WARN_CONSTANT_CONVERSION = YES; 408 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 409 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 410 | CLANG_WARN_EMPTY_BODY = YES; 411 | CLANG_WARN_ENUM_CONVERSION = YES; 412 | CLANG_WARN_INFINITE_RECURSION = YES; 413 | CLANG_WARN_INT_CONVERSION = YES; 414 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 415 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 416 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 417 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 418 | CLANG_WARN_STRICT_PROTOTYPES = YES; 419 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 420 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 421 | CLANG_WARN_UNREACHABLE_CODE = YES; 422 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 423 | CODE_SIGN_IDENTITY = "iPhone Developer"; 424 | COPY_PHASE_STRIP = NO; 425 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 426 | ENABLE_NS_ASSERTIONS = NO; 427 | ENABLE_STRICT_OBJC_MSGSEND = YES; 428 | GCC_C_LANGUAGE_STANDARD = gnu11; 429 | GCC_NO_COMMON_BLOCKS = YES; 430 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 431 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 432 | GCC_WARN_UNDECLARED_SELECTOR = YES; 433 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 434 | GCC_WARN_UNUSED_FUNCTION = YES; 435 | GCC_WARN_UNUSED_VARIABLE = YES; 436 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 437 | MTL_ENABLE_DEBUG_INFO = NO; 438 | SDKROOT = iphoneos; 439 | VALIDATE_PRODUCT = YES; 440 | }; 441 | name = Release; 442 | }; 443 | CBD460BD1FEA5E0A00BE35C3 /* Debug */ = { 444 | isa = XCBuildConfiguration; 445 | buildSettings = { 446 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 447 | CODE_SIGN_STYLE = Automatic; 448 | DEVELOPMENT_TEAM = 9RL8S7JFUQ; 449 | INFOPLIST_FILE = JMDropMenu/Info.plist; 450 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 451 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 452 | PRODUCT_BUNDLE_IDENTIFIER = com.ailaopo.JMDropMenu; 453 | PRODUCT_NAME = "$(TARGET_NAME)"; 454 | TARGETED_DEVICE_FAMILY = 1; 455 | }; 456 | name = Debug; 457 | }; 458 | CBD460BE1FEA5E0A00BE35C3 /* Release */ = { 459 | isa = XCBuildConfiguration; 460 | buildSettings = { 461 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 462 | CODE_SIGN_STYLE = Automatic; 463 | DEVELOPMENT_TEAM = 9RL8S7JFUQ; 464 | INFOPLIST_FILE = JMDropMenu/Info.plist; 465 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 466 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 467 | PRODUCT_BUNDLE_IDENTIFIER = com.ailaopo.JMDropMenu; 468 | PRODUCT_NAME = "$(TARGET_NAME)"; 469 | TARGETED_DEVICE_FAMILY = 1; 470 | }; 471 | name = Release; 472 | }; 473 | CBD460C01FEA5E0A00BE35C3 /* Debug */ = { 474 | isa = XCBuildConfiguration; 475 | buildSettings = { 476 | BUNDLE_LOADER = "$(TEST_HOST)"; 477 | CODE_SIGN_STYLE = Automatic; 478 | DEVELOPMENT_TEAM = 9RL8S7JFUQ; 479 | INFOPLIST_FILE = JMDropMenuTests/Info.plist; 480 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 481 | PRODUCT_BUNDLE_IDENTIFIER = com.ailaopo.JMDropMenuTests; 482 | PRODUCT_NAME = "$(TARGET_NAME)"; 483 | TARGETED_DEVICE_FAMILY = "1,2"; 484 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JMDropMenu.app/JMDropMenu"; 485 | }; 486 | name = Debug; 487 | }; 488 | CBD460C11FEA5E0A00BE35C3 /* Release */ = { 489 | isa = XCBuildConfiguration; 490 | buildSettings = { 491 | BUNDLE_LOADER = "$(TEST_HOST)"; 492 | CODE_SIGN_STYLE = Automatic; 493 | DEVELOPMENT_TEAM = 9RL8S7JFUQ; 494 | INFOPLIST_FILE = JMDropMenuTests/Info.plist; 495 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 496 | PRODUCT_BUNDLE_IDENTIFIER = com.ailaopo.JMDropMenuTests; 497 | PRODUCT_NAME = "$(TARGET_NAME)"; 498 | TARGETED_DEVICE_FAMILY = "1,2"; 499 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JMDropMenu.app/JMDropMenu"; 500 | }; 501 | name = Release; 502 | }; 503 | CBD460C31FEA5E0A00BE35C3 /* Debug */ = { 504 | isa = XCBuildConfiguration; 505 | buildSettings = { 506 | CODE_SIGN_STYLE = Automatic; 507 | DEVELOPMENT_TEAM = 9RL8S7JFUQ; 508 | INFOPLIST_FILE = JMDropMenuUITests/Info.plist; 509 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 510 | PRODUCT_BUNDLE_IDENTIFIER = com.ailaopo.JMDropMenuUITests; 511 | PRODUCT_NAME = "$(TARGET_NAME)"; 512 | TARGETED_DEVICE_FAMILY = "1,2"; 513 | TEST_TARGET_NAME = JMDropMenu; 514 | }; 515 | name = Debug; 516 | }; 517 | CBD460C41FEA5E0A00BE35C3 /* Release */ = { 518 | isa = XCBuildConfiguration; 519 | buildSettings = { 520 | CODE_SIGN_STYLE = Automatic; 521 | DEVELOPMENT_TEAM = 9RL8S7JFUQ; 522 | INFOPLIST_FILE = JMDropMenuUITests/Info.plist; 523 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 524 | PRODUCT_BUNDLE_IDENTIFIER = com.ailaopo.JMDropMenuUITests; 525 | PRODUCT_NAME = "$(TARGET_NAME)"; 526 | TARGETED_DEVICE_FAMILY = "1,2"; 527 | TEST_TARGET_NAME = JMDropMenu; 528 | }; 529 | name = Release; 530 | }; 531 | /* End XCBuildConfiguration section */ 532 | 533 | /* Begin XCConfigurationList section */ 534 | CBD4608B1FEA5E0900BE35C3 /* Build configuration list for PBXProject "JMDropMenu" */ = { 535 | isa = XCConfigurationList; 536 | buildConfigurations = ( 537 | CBD460BA1FEA5E0A00BE35C3 /* Debug */, 538 | CBD460BB1FEA5E0A00BE35C3 /* Release */, 539 | ); 540 | defaultConfigurationIsVisible = 0; 541 | defaultConfigurationName = Release; 542 | }; 543 | CBD460BC1FEA5E0A00BE35C3 /* Build configuration list for PBXNativeTarget "JMDropMenu" */ = { 544 | isa = XCConfigurationList; 545 | buildConfigurations = ( 546 | CBD460BD1FEA5E0A00BE35C3 /* Debug */, 547 | CBD460BE1FEA5E0A00BE35C3 /* Release */, 548 | ); 549 | defaultConfigurationIsVisible = 0; 550 | defaultConfigurationName = Release; 551 | }; 552 | CBD460BF1FEA5E0A00BE35C3 /* Build configuration list for PBXNativeTarget "JMDropMenuTests" */ = { 553 | isa = XCConfigurationList; 554 | buildConfigurations = ( 555 | CBD460C01FEA5E0A00BE35C3 /* Debug */, 556 | CBD460C11FEA5E0A00BE35C3 /* Release */, 557 | ); 558 | defaultConfigurationIsVisible = 0; 559 | defaultConfigurationName = Release; 560 | }; 561 | CBD460C21FEA5E0A00BE35C3 /* Build configuration list for PBXNativeTarget "JMDropMenuUITests" */ = { 562 | isa = XCConfigurationList; 563 | buildConfigurations = ( 564 | CBD460C31FEA5E0A00BE35C3 /* Debug */, 565 | CBD460C41FEA5E0A00BE35C3 /* Release */, 566 | ); 567 | defaultConfigurationIsVisible = 0; 568 | defaultConfigurationName = Release; 569 | }; 570 | /* End XCConfigurationList section */ 571 | }; 572 | rootObject = CBD460881FEA5E0900BE35C3 /* Project object */; 573 | } 574 | -------------------------------------------------------------------------------- /JMDropMenu.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JMDropMenu/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // JMDropMenu 4 | // 5 | // Created by JM on 2017/12/20. 6 | // Copyright © 2017年 JM. 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 | -------------------------------------------------------------------------------- /JMDropMenu/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // JMDropMenu 4 | // 5 | // Created by JM on 2017/12/20. 6 | // Copyright © 2017年 JM. 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 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /JMDropMenu/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /JMDropMenu/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /JMDropMenu/Assets.xcassets/img1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "img1.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /JMDropMenu/Assets.xcassets/img1.imageset/img1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JunAILiang/JMDropMenu/f1823374e71229befcb141886bd0e6bd5dc0a80e/JMDropMenu/Assets.xcassets/img1.imageset/img1.png -------------------------------------------------------------------------------- /JMDropMenu/Assets.xcassets/img2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "img2.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /JMDropMenu/Assets.xcassets/img2.imageset/img2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JunAILiang/JMDropMenu/f1823374e71229befcb141886bd0e6bd5dc0a80e/JMDropMenu/Assets.xcassets/img2.imageset/img2.png -------------------------------------------------------------------------------- /JMDropMenu/Assets.xcassets/img3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "img3.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /JMDropMenu/Assets.xcassets/img3.imageset/img3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JunAILiang/JMDropMenu/f1823374e71229befcb141886bd0e6bd5dc0a80e/JMDropMenu/Assets.xcassets/img3.imageset/img3.png -------------------------------------------------------------------------------- /JMDropMenu/Assets.xcassets/img4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "img4.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /JMDropMenu/Assets.xcassets/img4.imageset/img4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JunAILiang/JMDropMenu/f1823374e71229befcb141886bd0e6bd5dc0a80e/JMDropMenu/Assets.xcassets/img4.imageset/img4.png -------------------------------------------------------------------------------- /JMDropMenu/Assets.xcassets/img5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "img5.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /JMDropMenu/Assets.xcassets/img5.imageset/img5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JunAILiang/JMDropMenu/f1823374e71229befcb141886bd0e6bd5dc0a80e/JMDropMenu/Assets.xcassets/img5.imageset/img5.png -------------------------------------------------------------------------------- /JMDropMenu/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /JMDropMenu/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 | -------------------------------------------------------------------------------- /JMDropMenu/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /JMDropMenu/JMDropMenu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JunAILiang/JMDropMenu/f1823374e71229befcb141886bd0e6bd5dc0a80e/JMDropMenu/JMDropMenu.gif -------------------------------------------------------------------------------- /JMDropMenu/JMDropMenu/JMDropMenu.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMDropMenu.h 3 | // JMDropMenu 4 | // 5 | // Created by JM on 2017/12/20. 6 | // Copyright © 2017年 JM. All rights reserved. 7 | // 8 | 9 | #import 10 | @class JMDropMenuModel; 11 | @class JMDropMenuCell; 12 | 13 | typedef NS_ENUM(NSInteger, JMDropMenuLayoutType) { 14 | JMDropMenuLayoutTypeNormal, //图片在左, 文字在右 15 | JMDropMenuLayoutTypeTitle, //只有文字 16 | }; 17 | 18 | typedef NS_ENUM(NSInteger, JMDropMenuType) { 19 | JMDropMenuTypeWeChat, //仿微信 20 | JMDropMenuTypeQQ, //仿QQ 21 | }; 22 | 23 | @protocol JMDropMenuDelegate 24 | 25 | - (void)didSelectRowAtIndex:(NSInteger)index Title:(NSString *)title Image:(NSString *)image; 26 | 27 | @end 28 | 29 | @interface JMDropMenu : UIView 30 | 31 | /** 32 | * 显示下拉菜单 33 | * frame 显示的位置以及大小 34 | * arrowOffset 箭头的x偏移值 35 | * titleArr 标题数组 36 | * imageArr 如果不需要显示图片可穿空 37 | * layoutType 显示图片和文字或者只显示文字(默认显示图片和文字) 38 | * type 仿qq还是微信 (如果是自定义可以传任何正整数) 39 | * rowHeight 每一行的高度 40 | */ 41 | + (instancetype)showDropMenuFrame:(CGRect)frame ArrowOffset:(CGFloat)arrowOffset TitleArr:(NSArray *)titleArr ImageArr:(NSArray *)imageArr Type:(JMDropMenuType)type LayoutType:(JMDropMenuLayoutType)layoutType RowHeight:(CGFloat)rowHeight Delegate:(id)delegate; 42 | 43 | - (instancetype)initWithFrame:(CGRect)frame ArrowOffset:(CGFloat)arrowOffset TitleArr:(NSArray *)titleArr ImageArr:(NSArray *)imageArr Type:(JMDropMenuType)type LayoutType:(JMDropMenuLayoutType)layoutType RowHeight:(CGFloat)rowHeight Delegate:(id)delegate; 44 | 45 | /** 移除下拉菜单 */ 46 | - (void)removeDropMenu; 47 | 48 | 49 | /** 文字颜色 */ 50 | @property (nonatomic, strong) UIColor *titleColor; 51 | /** 线条颜色 */ 52 | @property (nonatomic, strong) UIColor *lineColor; 53 | /** 箭头x偏移值 */ 54 | @property (nonatomic, assign) CGFloat arrowOffset; 55 | /** 布局类型 (图片再左, 文字在右) */ 56 | @property (nonatomic, assign) JMDropMenuLayoutType LayoutType; 57 | /** 箭头的颜色(UIColor类型) */ 58 | @property (nonatomic, strong) UIColor *arrowColor; 59 | /** 箭头的颜色(16进制类型, 传16进制值即可, 例 #ffffff) */ 60 | @property (nonatomic, copy) NSString *arrowColor16; 61 | /** 代理 */ 62 | @property (nonatomic, weak) id delegate; 63 | 64 | @end 65 | 66 | 67 | 68 | 69 | 70 | @class JMDropMenuModel; 71 | @interface JMDropMenuCell : UITableViewCell 72 | 73 | + (instancetype)dropMenuCellWithTableView:(UITableView *)tableView; 74 | 75 | /** 数据模型 */ 76 | @property (nonatomic, strong) JMDropMenuModel *model; 77 | /** 图片 */ 78 | @property (nonatomic, strong) UIImageView *imageIV; 79 | /** 标题 */ 80 | @property (nonatomic, strong) UILabel *titleL; 81 | /** 线条 */ 82 | @property (nonatomic, strong) UIImageView *line1; 83 | 84 | @end 85 | 86 | 87 | 88 | @interface JMDropMenuModel : NSObject 89 | 90 | /** 图片 */ 91 | @property (nonatomic, copy) NSString *image; 92 | /** 文字 */ 93 | @property (nonatomic, copy) NSString *title; 94 | /** type */ 95 | @property (nonatomic, assign) JMDropMenuType type; 96 | /** layoutType */ 97 | @property (nonatomic, assign) JMDropMenuLayoutType layoutType; 98 | 99 | - (instancetype)initWithDictonary:(NSDictionary *)dict; 100 | + (instancetype)dropMenuWithDictonary:(NSDictionary *)dict; 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /JMDropMenu/JMDropMenu/JMDropMenu.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMDropMenu.m 3 | // JMDropMenu 4 | // 5 | // Created by JM on 2017/12/20. 6 | // Copyright © 2017年 JM. All rights reserved. 7 | // 8 | 9 | #import "JMDropMenu.h" 10 | 11 | #define kWindow [UIApplication sharedApplication].keyWindow 12 | #define kCellIdentifier @"cellIdentifier" 13 | #define kDropMenuCellID @"DropMenuCellID" 14 | 15 | @interface JMDropMenu() 16 | /** 蒙版 */ 17 | @property (nonatomic, strong) UIView *cover; 18 | /** tableView */ 19 | @property (nonatomic, strong) UITableView *tableView; 20 | /** 存放标题和图片数组 */ 21 | @property (nonatomic, strong) NSMutableArray *titleImageArrM; 22 | /** rowHeight */ 23 | @property (nonatomic, assign) CGFloat rowHeight; 24 | /** rgb的可变数组 */ 25 | @property (nonatomic, strong) NSMutableArray *RGBStrValueArr; 26 | /** 类型(qq或者微信) */ 27 | @property (nonatomic, assign) JMDropMenuType type; 28 | @end 29 | 30 | @implementation JMDropMenu 31 | 32 | - (NSMutableArray *)titleImageArrM { 33 | if (!_titleImageArrM) { 34 | _titleImageArrM = [NSMutableArray array]; 35 | } 36 | return _titleImageArrM; 37 | } 38 | 39 | - (NSMutableArray *)RGBStrValueArr { 40 | if (!_RGBStrValueArr) { 41 | _RGBStrValueArr = [NSMutableArray array]; 42 | } 43 | return _RGBStrValueArr; 44 | } 45 | 46 | - (instancetype)initWithFrame:(CGRect)frame ArrowOffset:(CGFloat)arrowOffset TitleArr:(NSArray *)titleArr ImageArr:(NSArray *)imageArr Type:(JMDropMenuType)type LayoutType:(JMDropMenuLayoutType)layoutType RowHeight:(CGFloat)rowHeight Delegate:(id)delegate { 47 | if (self = [super initWithFrame:frame]) { 48 | //初始化赋值 49 | self.frame = frame; 50 | _arrowOffset = arrowOffset; 51 | _type = type; 52 | _LayoutType = layoutType; 53 | _rowHeight = rowHeight; 54 | _delegate = delegate; 55 | //类型判断 56 | if (type == JMDropMenuTypeWeChat) { 57 | self.RGBStrValueArr = [NSMutableArray arrayWithObjects:@(54),@(54),@(54), nil]; 58 | _titleColor = [UIColor whiteColor]; 59 | _lineColor = [UIColor whiteColor]; 60 | } else { 61 | self.RGBStrValueArr = [NSMutableArray arrayWithObjects:@(255),@(255),@(255), nil]; 62 | _titleColor = [UIColor blackColor]; 63 | _lineColor = [UIColor lightGrayColor]; 64 | } 65 | //字典转模型 66 | for (int i = 0; i < titleArr.count; i++) { 67 | NSMutableDictionary *tempDict = [NSMutableDictionary dictionary]; 68 | [tempDict setObject:titleArr[i] forKey:@"title"]; 69 | if (i != imageArr.count) { 70 | [tempDict setObject:imageArr[i] forKey:@"image"]; 71 | } 72 | [tempDict setObject:@(layoutType) forKey:@"layoutType"]; 73 | [tempDict setObject:@(type) forKey:@"type"]; 74 | JMDropMenuModel *model = [JMDropMenuModel dropMenuWithDictonary:tempDict]; 75 | [self.titleImageArrM addObject:model]; 76 | } 77 | 78 | 79 | [kWindow addSubview:self.cover]; 80 | UITapGestureRecognizer *tapCover = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapCoverClick)]; 81 | [self.cover addGestureRecognizer:tapCover]; 82 | 83 | self.backgroundColor = [UIColor clearColor]; 84 | [[UIApplication sharedApplication].keyWindow addSubview:self]; 85 | 86 | [self addSubview:self.tableView]; 87 | } 88 | return self; 89 | } 90 | 91 | + (instancetype)showDropMenuFrame:(CGRect)frame ArrowOffset:(CGFloat)arrowOffset TitleArr:(NSArray *)titleArr ImageArr:(NSArray *)imageArr Type:(JMDropMenuType)type LayoutType:(JMDropMenuLayoutType)layoutType RowHeight:(CGFloat)rowHeight Delegate:(id)delegate{ 92 | return [[self alloc] initWithFrame:frame ArrowOffset:arrowOffset TitleArr:titleArr ImageArr:imageArr Type:type LayoutType:layoutType RowHeight:rowHeight Delegate:delegate]; 93 | } 94 | 95 | - (UITableView *)tableView { 96 | if (!_tableView) { 97 | _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 8, self.frame.size.width, self.frame.size.height - 8) style:UITableViewStylePlain]; 98 | _tableView.delegate = self; 99 | _tableView.dataSource = self; 100 | _tableView.tableFooterView = [UIView new]; 101 | _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 102 | _tableView.scrollEnabled = NO; 103 | _tableView.layer.masksToBounds = YES; 104 | _tableView.layer.cornerRadius = 6.f; 105 | if (_type == JMDropMenuTypeWeChat) { 106 | _tableView.backgroundColor = [UIColor colorWithRed:54 / 255.0 green:54 / 255.0 blue:54 / 255.0 alpha:1]; 107 | } else { 108 | _tableView.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1]; 109 | } 110 | } 111 | return _tableView; 112 | } 113 | 114 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 115 | return self.titleImageArrM.count; 116 | } 117 | 118 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 119 | JMDropMenuCell *cell = [JMDropMenuCell dropMenuCellWithTableView:tableView]; 120 | cell.model = self.titleImageArrM[indexPath.row]; 121 | float r = [self.RGBStrValueArr[0] floatValue] / 255.0; 122 | float g = [self.RGBStrValueArr[1] floatValue] / 255.0; 123 | float b = [self.RGBStrValueArr[2] floatValue] / 255.0; 124 | cell.backgroundColor = [UIColor colorWithRed:r green:g blue:b alpha:1]; 125 | cell.titleL.textColor = _titleColor; 126 | cell.line1.backgroundColor = _lineColor; 127 | return cell; 128 | } 129 | 130 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 131 | JMDropMenuModel *model = self.titleImageArrM[indexPath.row]; 132 | if ([_delegate respondsToSelector:@selector(didSelectRowAtIndex:Title:Image:)]) { 133 | [_delegate didSelectRowAtIndex:indexPath.row Title:model.title Image:model.image]; 134 | } 135 | [self removeDropMenu]; 136 | } 137 | 138 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 139 | return _rowHeight; 140 | } 141 | 142 | - (UIView *)cover { 143 | if (!_cover) { 144 | _cover = [[UIView alloc] initWithFrame:kWindow.bounds]; 145 | _cover.backgroundColor = [UIColor blackColor]; 146 | _cover.alpha = 0.1; 147 | } 148 | return _cover; 149 | } 150 | 151 | #pragma mark - 蒙版点击 152 | - (void)tapCoverClick { 153 | [self removeDropMenu]; 154 | } 155 | 156 | #pragma mark - 隐藏蒙版 157 | - (void)removeDropMenu { 158 | [self.tableView removeFromSuperview]; 159 | [self.cover removeFromSuperview]; 160 | [self removeFromSuperview]; 161 | } 162 | 163 | // 覆盖drawRect方法,你可以在此自定义绘画和动画 164 | - (void)drawRect:(CGRect)rect 165 | { 166 | //An opaque type that represents a Quartz 2D drawing environment. 167 | //一个不透明类型的Quartz 2D绘画环境,相当于一个画布,你可以在上面任意绘画 168 | CGContextRef context = UIGraphicsGetCurrentContext(); 169 | /*画三角形*/ 170 | CGPoint sPoints[3];//坐标点 171 | sPoints[0] = CGPointMake(_arrowOffset, 0);//坐标1 172 | sPoints[1] = CGPointMake(_arrowOffset - 8, 8);//坐标2 173 | sPoints[2] = CGPointMake(_arrowOffset + 8, 8);//坐标3 174 | CGContextAddLines(context, sPoints, 3);//添加线 175 | //填充色 176 | float r = [self.RGBStrValueArr[0] floatValue] / 255.0; 177 | float g = [self.RGBStrValueArr[1] floatValue] / 255.0; 178 | float b = [self.RGBStrValueArr[2] floatValue] / 255.0; 179 | UIColor *aColor = [UIColor colorWithRed:r green:g blue:b alpha:1]; 180 | CGContextSetFillColorWithColor(context, aColor.CGColor); 181 | //画线笔颜色 182 | CGContextSetRGBStrokeColor(context,r, g, b,1.0);//画笔线的颜色 183 | CGContextClosePath(context);//封起来 184 | CGContextDrawPath(context, kCGPathFillStroke); //根据坐标绘制路径 185 | } 186 | 187 | //将UIColor转换为RGB值 188 | - (NSMutableArray *)changeUIColorToRGB:(UIColor *)color 189 | { 190 | NSMutableArray *RGBStrValueArr = [[NSMutableArray alloc] init]; 191 | NSString *RGBStr = nil; 192 | //获得RGB值描述 193 | NSString *RGBValue = [NSString stringWithFormat:@"%@",color]; 194 | //将RGB值描述分隔成字符串 195 | NSArray *RGBArr = [RGBValue componentsSeparatedByString:@" "]; 196 | //获取红色值 197 | int r = [[RGBArr objectAtIndex:1] intValue] * 255; 198 | RGBStr = [NSString stringWithFormat:@"%d",r]; 199 | [RGBStrValueArr addObject:RGBStr]; 200 | //获取绿色值 201 | int g = [[RGBArr objectAtIndex:2] intValue] * 255; 202 | RGBStr = [NSString stringWithFormat:@"%d",g]; 203 | [RGBStrValueArr addObject:RGBStr]; 204 | //获取蓝色值 205 | int b = [[RGBArr objectAtIndex:3] intValue] * 255; 206 | RGBStr = [NSString stringWithFormat:@"%d",b]; 207 | [RGBStrValueArr addObject:RGBStr]; 208 | //返回保存RGB值的数组 209 | return RGBStrValueArr; 210 | } 211 | 212 | //16进制颜色(html颜色值)字符串转为UIColor 213 | - (NSMutableArray *)hexStringToColor:(NSString *)stringToConvert 214 | { 215 | NSString *cString = [[stringToConvert stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString]; 216 | // String should be 6 or 8 characters 217 | 218 | // if ([cString length] < 6) return [UIColor blackColor]; 219 | // strip 0X if it appears 220 | if ([cString hasPrefix:@"0X"]) cString = [cString substringFromIndex:2]; 221 | if ([cString hasPrefix:@"#"]) cString = [cString substringFromIndex:1]; 222 | // if ([cString length] != 6) return [UIColor blackColor]; 223 | 224 | // Separate into r, g, b substrings 225 | 226 | NSRange range; 227 | range.location = 0; 228 | range.length = 2; 229 | NSString *rString = [cString substringWithRange:range]; 230 | range.location = 2; 231 | NSString *gString = [cString substringWithRange:range]; 232 | range.location = 4; 233 | NSString *bString = [cString substringWithRange:range]; 234 | // Scan values 235 | unsigned int r, g, b; 236 | 237 | [[NSScanner scannerWithString:rString] scanHexInt:&r]; 238 | [[NSScanner scannerWithString:gString] scanHexInt:&g]; 239 | [[NSScanner scannerWithString:bString] scanHexInt:&b]; 240 | 241 | return [NSMutableArray arrayWithObjects:@(r),@(g),@(b), nil]; 242 | } 243 | 244 | #pragma mark - 箭头x偏移值 245 | - (void)setArrowOffset:(CGFloat)arrowOffset { 246 | _arrowOffset = arrowOffset; 247 | [self setNeedsDisplay]; 248 | } 249 | #pragma mark - 类型 250 | - (void)setLayoutType:(JMDropMenuLayoutType)LayoutType { 251 | _LayoutType = LayoutType; 252 | for (JMDropMenuModel *model in self.titleImageArrM) { 253 | model.layoutType = LayoutType; 254 | } 255 | [self.tableView reloadData]; 256 | } 257 | 258 | #pragma mark - 箭头颜色 259 | - (void)setArrowColor:(UIColor *)arrowColor { 260 | _arrowColor = arrowColor; 261 | self.RGBStrValueArr = [self changeUIColorToRGB:arrowColor]; 262 | [self setNeedsDisplay]; 263 | } 264 | 265 | - (void)setArrowColor16:(NSString *)arrowColor16 { 266 | _arrowColor16 = arrowColor16; 267 | self.RGBStrValueArr = [self hexStringToColor:arrowColor16]; 268 | [self setNeedsDisplay]; 269 | } 270 | 271 | #pragma mark - 文字颜色 272 | - (void)setTitleColor:(UIColor *)titleColor { 273 | _titleColor = titleColor; 274 | [self.tableView reloadData]; 275 | } 276 | 277 | #pragma mark - 线条颜色 278 | - (void)setLineColor:(UIColor *)lineColor { 279 | _lineColor = lineColor; 280 | [self.tableView reloadData]; 281 | } 282 | 283 | @end 284 | 285 | 286 | @interface JMDropMenuCell() 287 | /** 屏幕中心点 */ 288 | @property (nonatomic, assign) CGFloat screenCenter; 289 | @end 290 | 291 | @implementation JMDropMenuCell 292 | 293 | + (instancetype)dropMenuCellWithTableView:(UITableView *)tableView { 294 | JMDropMenuCell *cell = [tableView dequeueReusableCellWithIdentifier:kDropMenuCellID]; 295 | if (!cell) { 296 | cell = [[JMDropMenuCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kDropMenuCellID]; 297 | } 298 | return cell; 299 | } 300 | 301 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 302 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 303 | self.imageIV = [[UIImageView alloc] init]; 304 | [self.contentView addSubview:self.imageIV]; 305 | 306 | self.titleL = [[UILabel alloc] init]; 307 | self.titleL.textColor = [UIColor blackColor]; 308 | self.titleL.font = [UIFont systemFontOfSize:15.f]; 309 | [self.contentView addSubview:self.titleL]; 310 | 311 | self.line1 = [[UIImageView alloc] init]; 312 | self.line1.backgroundColor = [UIColor lightGrayColor]; 313 | [self.contentView addSubview:self.line1]; 314 | 315 | self.selectionStyle = UITableViewCellSelectionStyleNone; 316 | } 317 | return self; 318 | } 319 | 320 | - (void)layoutSubviews { 321 | [super layoutSubviews]; 322 | 323 | self.screenCenter = self.contentView.frame.size.height * 0.5; 324 | 325 | self.imageIV.frame = CGRectMake(10, self.screenCenter - 8, 16, 16); 326 | if (self.model.layoutType == JMDropMenuLayoutTypeTitle) { 327 | self.titleL.frame = CGRectMake(10, self.screenCenter - 10, self.frame.size.width, 20); 328 | } else { 329 | self.titleL.frame = CGRectMake(CGRectGetMaxX(self.imageIV.frame) + 10, self.screenCenter - 10, self.contentView.frame.size.width - 50, 20); 330 | } 331 | self.line1.frame = CGRectMake(0, self.contentView.frame.size.height - 0.5, self.contentView.frame.size.width, 0.5); 332 | } 333 | 334 | - (void)setModel:(JMDropMenuModel *)model { 335 | _model = model; 336 | if (model.layoutType == JMDropMenuLayoutTypeTitle) { 337 | self.titleL.frame = CGRectMake(10, self.screenCenter - 10, self.frame.size.width, 20); 338 | } else { 339 | self.imageIV.image = [UIImage imageNamed:model.image]; 340 | } 341 | if (model.type == JMDropMenuTypeQQ) { 342 | self.titleL.textColor = [UIColor blackColor]; 343 | self.line1.backgroundColor = [UIColor lightGrayColor]; 344 | } else { 345 | self.titleL.textColor = [UIColor whiteColor]; 346 | self.line1.backgroundColor = [UIColor whiteColor]; 347 | } 348 | self.titleL.text = model.title; 349 | } 350 | 351 | @end 352 | 353 | 354 | @interface JMDropMenuModel() 355 | @end 356 | @implementation JMDropMenuModel 357 | 358 | - (instancetype)initWithDictonary:(NSDictionary *)dict { 359 | if (self = [super init]) { 360 | [self setValuesForKeysWithDictionary:dict]; 361 | } 362 | return self; 363 | } 364 | 365 | + (instancetype)dropMenuWithDictonary:(NSDictionary *)dict { 366 | return [[self alloc] initWithDictonary:dict]; 367 | } 368 | 369 | @end 370 | 371 | 372 | 373 | -------------------------------------------------------------------------------- /JMDropMenu/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // JMDropMenu 4 | // 5 | // Created by JM on 2017/12/20. 6 | // Copyright © 2017年 JM. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /JMDropMenu/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // JMDropMenu 4 | // 5 | // Created by JM on 2017/12/20. 6 | // Copyright © 2017年 JM. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "JMDropMenu.h" 11 | 12 | @interface ViewController () 13 | 14 | /** 按钮 */ 15 | @property (nonatomic, strong) UIButton *btn; 16 | /** titleArr */ 17 | @property (nonatomic, strong) NSArray *titleArr; 18 | /** imgArr */ 19 | @property (nonatomic, strong) NSArray *imageArr; 20 | 21 | @end 22 | 23 | @implementation ViewController 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | 28 | self.title = @"超强封装"; 29 | 30 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(navRightClick)]; 31 | 32 | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(navLeftClick)]; 33 | 34 | self.titleArr = @[@"创建群聊",@"加好友/群",@"扫一扫",@"付款",@"拍摄"]; 35 | self.imageArr = @[@"img1",@"img2",@"img3",@"img4",@"img5"]; 36 | 37 | 38 | self.btn = [UIButton buttonWithType:UIButtonTypeCustom]; 39 | [self.btn setTitle:@"自定义样式" forState:UIControlStateNormal]; 40 | self.btn.backgroundColor = [UIColor redColor]; 41 | self.btn.frame = CGRectMake(140, 120, 100, 50); 42 | [self.btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside]; 43 | [self.view addSubview:self.btn]; 44 | } 45 | 46 | #pragma mark - 左边 47 | - (void)navLeftClick { 48 | [JMDropMenu showDropMenuFrame:CGRectMake(8, 64, 120, 208) ArrowOffset:16.f TitleArr:self.titleArr ImageArr:self.imageArr Type:JMDropMenuTypeWeChat LayoutType:JMDropMenuLayoutTypeNormal RowHeight:40.f Delegate:self]; 49 | } 50 | 51 | #pragma mark - 右边 52 | - (void)navRightClick { 53 | [JMDropMenu showDropMenuFrame:CGRectMake(self.view.frame.size.width - 128, 64, 120, 208) ArrowOffset:102.f TitleArr:self.titleArr ImageArr:self.imageArr Type:JMDropMenuTypeQQ LayoutType:JMDropMenuLayoutTypeNormal RowHeight:40.f Delegate:self]; 54 | } 55 | 56 | #pragma mark - 自定义按钮 57 | - (void)btnClick { 58 | JMDropMenu *dropMenu = [[JMDropMenu alloc] initWithFrame:CGRectMake(126, 170, 130, 208) ArrowOffset:60.f TitleArr:self.titleArr ImageArr:self.imageArr Type:JMDropMenuTypeWeChat LayoutType:JMDropMenuLayoutTypeNormal RowHeight:40.f Delegate:self]; 59 | dropMenu.titleColor = [UIColor redColor]; 60 | dropMenu.lineColor = [UIColor greenColor]; 61 | dropMenu.arrowColor = [UIColor blueColor]; 62 | // dropMenu.LayoutType = JMDropMenuLayoutTypeTitle; 63 | // dropMenu.arrowColor = [UIColor redColor]; 64 | } 65 | 66 | - (void)didSelectRowAtIndex:(NSInteger)index Title:(NSString *)title Image:(NSString *)image { 67 | NSLog(@"index----%zd, title---%@, image---%@", index, title, image); 68 | } 69 | 70 | @end 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /JMDropMenu/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JMDropMenu 4 | // 5 | // Created by JM on 2017/12/20. 6 | // Copyright © 2017年 JM. 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 | -------------------------------------------------------------------------------- /JMDropMenuTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /JMDropMenuTests/JMDropMenuTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMDropMenuTests.m 3 | // JMDropMenuTests 4 | // 5 | // Created by JM on 2017/12/20. 6 | // Copyright © 2017年 JM. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JMDropMenuTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation JMDropMenuTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /JMDropMenuUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /JMDropMenuUITests/JMDropMenuUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMDropMenuUITests.m 3 | // JMDropMenuUITests 4 | // 5 | // Created by JM on 2017/12/20. 6 | // Copyright © 2017年 JM. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JMDropMenuUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation JMDropMenuUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 JunAILiang 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JMDropMenu 2 | 仿QQ、微信下拉菜单封装, 一行代码实现QQ和微信的下拉菜单 3 | * 支持自定义样式 4 | * 支持CocoaPods 5 | 6 | ![](https://github.com/JunAILiang/JMDropMenu/raw/master/JMDropMenu/JMDropMenu.gif) 7 | 8 | # 如何使用 9 | * 通过CocoaPods导入 `pod 'JMDropMenu', '~> 0.1.1'` 10 | * 手动导入 直接下载工程把 `JMDropMenu` 文件夹导入到自己工程中 11 | 12 | ## 初始化数据 13 | ``` 14 | self.titleArr = @[@"创建群聊",@"加好友/群",@"扫一扫",@"付款",@"拍摄"]; 15 | self.imageArr = @[@"img1",@"img2",@"img3",@"img4",@"img5"]; 16 | ``` 17 | 18 | ## 一行代码调用 19 | ``` 20 | [JMDropMenu showDropMenuFrame:CGRectMake(8, 64, 120, 208) ArrowOffset:16.f TitleArr:self.titleArr ImageArr:self.imageArr Type:JMDropMenuTypeWeChat LayoutType:JMDropMenuLayoutTypeNormal RowHeight:40.f Delegate:self]; 21 | ``` 22 | 23 | ## 遵守代理 24 | ``` 25 | - (void)didSelectRowAtIndex:(NSInteger)index Title:(NSString *)title Image:(NSString *)image { 26 | NSLog(@"index----%zd, title---%@, image---%@", index, title, image); 27 | } 28 | ``` 29 | ## 你也可以高度自定义 30 | ``` 31 | /** 文字颜色 */ 32 | @property (nonatomic, strong) UIColor *titleColor; 33 | /** 线条颜色 */ 34 | @property (nonatomic, strong) UIColor *lineColor; 35 | /** 箭头x偏移值 */ 36 | @property (nonatomic, assign) CGFloat arrowOffset; 37 | /** 布局类型 (图片再左, 文字在右) */ 38 | @property (nonatomic, assign) JMDropMenuLayoutType LayoutType; 39 | /** 箭头的颜色(UIColor类型) */ 40 | @property (nonatomic, strong) UIColor *arrowColor; 41 | /** 箭头的颜色(16进制类型, 传16进制值即可, 例 #ffffff) */ 42 | @property (nonatomic, copy) NSString *arrowColor16; 43 | ``` 44 | 45 | #### 联系我: 46 | * qq: 1245424073 47 | [我的博客](https://ljmvip.cn) 48 | --------------------------------------------------------------------------------