├── .gitignore ├── JRDropMenu.podspec ├── JRDropMenuDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── JRDropMenuDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── checkMark.imageset │ │ ├── Contents.json │ │ ├── checkMark@2x.png │ │ └── checkMark@3x.png │ ├── down_arrow.imageset │ │ ├── Contents.json │ │ ├── down_arrow@2x.png │ │ └── down_arrow@3x.png │ └── up_arrow.imageset │ │ ├── Contents.json │ │ ├── up_arrow@2x.png │ │ └── up_arrow@3x.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── FirstViewController.h ├── FirstViewController.m ├── Info.plist ├── JRDropMenu │ ├── JRCategory.h │ ├── JRCategory.m │ ├── JRDropAssets.xcassets │ │ ├── Contents.json │ │ ├── checkMark.imageset │ │ │ ├── Contents.json │ │ │ ├── checkMark@2x.png │ │ │ └── checkMark@3x.png │ │ ├── down_arrow.imageset │ │ │ ├── Contents.json │ │ │ ├── down_arrow@2x.png │ │ │ └── down_arrow@3x.png │ │ └── up_arrow.imageset │ │ │ ├── Contents.json │ │ │ ├── up_arrow@2x.png │ │ │ └── up_arrow@3x.png │ ├── JRDropMenuCell.h │ ├── JRDropMenuCell.m │ ├── JRDropMenuCell.xib │ ├── JRDropMenuItemModel.h │ ├── JRDropMenuItemModel.m │ ├── JRDropMenuView.h │ ├── JRDropMenuView.m │ ├── JRDropTitleItemView.h │ ├── JRDropTitleItemView.m │ ├── JRGlobalMacro.h │ ├── JRList.h │ ├── JRList.m │ ├── JROption.h │ ├── JROption.m │ ├── JRTitle.h │ └── JRTitle.m ├── SceneDelegate.h ├── SceneDelegate.m ├── SecondViewController.h ├── SecondViewController.m ├── ViewController.h ├── ViewController.m └── main.m ├── LICENSE ├── README.md └── ScreenShots ├── 1.png ├── 10.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png └── 9.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | # CocoaPods 34 | # 35 | # We recommend against adding the Pods directory to your .gitignore. However 36 | # you should judge for yourself, the pros and cons are mentioned at: 37 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 38 | # 39 | # Pods/ 40 | # 41 | # Add this line if you want to avoid checking in source code from the Xcode workspace 42 | # *.xcworkspace 43 | 44 | # Carthage 45 | # 46 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 47 | # Carthage/Checkouts 48 | 49 | Carthage/Build/ 50 | 51 | # fastlane 52 | # 53 | # It is recommended to not store the screenshots in the git repo. 54 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 55 | # For more information about the recommended setup visit: 56 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 57 | 58 | fastlane/report.xml 59 | fastlane/Preview.html 60 | fastlane/screenshots/**/*.png 61 | fastlane/test_output 62 | 63 | # Code Injection 64 | # 65 | # After new code Injection tools there's a generated folder /iOSInjectionProject 66 | # https://github.com/johnno1962/injectionforxcode 67 | 68 | iOSInjectionProject/ 69 | -------------------------------------------------------------------------------- /JRDropMenu.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'JRDropMenu' 3 | s.version = '1.0.3' 4 | s.summary = 'JRDropMenu是一款可高自定义的声明式下拉菜单控件' 5 | s.description = <<-DESC 6 | *** 7 | ## Features: 8 | 1. 支持iOS9+. 9 | 2. 声明式构建. 10 | 3. 自定义标题和列表属性. 11 | 4. 根据内容自适应标题位置。 12 | *** 13 | DESC 14 | s.homepage = 'https://github.com/andy123234/JRDropMenu' 15 | s.license = { :type => "MIT", :file => 'LICENSE' } 16 | s.authors = {'An An' => '736577528@qq.com'} 17 | s.platform = :ios, '9.0' 18 | s.source = {:git => 'https://github.com/andy123234/JRDropMenu.git', :tag => s.version} 19 | s.social_media_url = 'https://github.com/andy123234/JRDropMenu' 20 | s.source_files = 'JRDropMenuDemo/JRDropMenu/*.{h,m}' 21 | s.resources = 'JRDropMenuDemo/JRDropMenu/*.xib','JRDropMenuDemo/*.xcassets' 22 | s.resource_bundles = { 'JRDropMenuDemo' => 'JRDropMenuDemo/JRDropMenu/JRDropMenuBundle.bundle' } 23 | s.prefix_header_contents = '#import "JRGlobalMacro.h"' 24 | s.requires_arc = true 25 | s.ios.frameworks = 'UIKit' 26 | s.ios.deployment_target = '9.0' 27 | end 28 | -------------------------------------------------------------------------------- /JRDropMenuDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3D2391CF2493266600392A4E /* JROption.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D2391CE2493266600392A4E /* JROption.m */; }; 11 | 3D2391D224932E4F00392A4E /* JRTitle.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D2391D124932E4F00392A4E /* JRTitle.m */; }; 12 | 3D2391D524932FA500392A4E /* JRList.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D2391D424932FA500392A4E /* JRList.m */; }; 13 | 3D2391D82494FD0C00392A4E /* JRCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D2391D72494FD0C00392A4E /* JRCategory.m */; }; 14 | 3D2391F62495BC7600392A4E /* FirstViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D2391F52495BC7600392A4E /* FirstViewController.m */; }; 15 | 3D2391F92495BC8000392A4E /* SecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D2391F82495BC8000392A4E /* SecondViewController.m */; }; 16 | 3D66F6E02484AB4000E7EF78 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D66F6DF2484AB4000E7EF78 /* AppDelegate.m */; }; 17 | 3D66F6E62484AB4000E7EF78 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D66F6E52484AB4000E7EF78 /* ViewController.m */; }; 18 | 3D66F6E92484AB4000E7EF78 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3D66F6E72484AB4000E7EF78 /* Main.storyboard */; }; 19 | 3D66F6EB2484AB4200E7EF78 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D66F6EA2484AB4200E7EF78 /* Assets.xcassets */; }; 20 | 3D66F6EE2484AB4200E7EF78 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3D66F6EC2484AB4200E7EF78 /* LaunchScreen.storyboard */; }; 21 | 3D66F6F12484AB4200E7EF78 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D66F6F02484AB4200E7EF78 /* main.m */; }; 22 | 3D66F6FA2484ABAD00E7EF78 /* JRDropMenuView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D66F6F92484ABAD00E7EF78 /* JRDropMenuView.m */; }; 23 | 3D66F6FD2484AEE800E7EF78 /* JRDropTitleItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D66F6FC2484AEE800E7EF78 /* JRDropTitleItemView.m */; }; 24 | 3D66F7002484B18E00E7EF78 /* JRDropMenuItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D66F6FF2484B18E00E7EF78 /* JRDropMenuItemModel.m */; }; 25 | 3D66F7072484B4E300E7EF78 /* JRDropMenuCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D66F7052484B4E300E7EF78 /* JRDropMenuCell.m */; }; 26 | 3D66F7082484B4E300E7EF78 /* JRDropMenuCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3D66F7062484B4E300E7EF78 /* JRDropMenuCell.xib */; }; 27 | 3D68BB66249A08F9006D0203 /* JRDropAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D68BB65249A08F9006D0203 /* JRDropAssets.xcassets */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 3D2391CC2493232600392A4E /* JRGlobalMacro.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JRGlobalMacro.h; sourceTree = ""; }; 32 | 3D2391CD2493266600392A4E /* JROption.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JROption.h; sourceTree = ""; }; 33 | 3D2391CE2493266600392A4E /* JROption.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JROption.m; sourceTree = ""; }; 34 | 3D2391D024932E4F00392A4E /* JRTitle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JRTitle.h; sourceTree = ""; }; 35 | 3D2391D124932E4F00392A4E /* JRTitle.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JRTitle.m; sourceTree = ""; }; 36 | 3D2391D324932FA500392A4E /* JRList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JRList.h; sourceTree = ""; }; 37 | 3D2391D424932FA500392A4E /* JRList.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JRList.m; sourceTree = ""; }; 38 | 3D2391D62494FD0C00392A4E /* JRCategory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JRCategory.h; sourceTree = ""; }; 39 | 3D2391D72494FD0C00392A4E /* JRCategory.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JRCategory.m; sourceTree = ""; }; 40 | 3D2391F42495BC7600392A4E /* FirstViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FirstViewController.h; sourceTree = ""; }; 41 | 3D2391F52495BC7600392A4E /* FirstViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FirstViewController.m; sourceTree = ""; }; 42 | 3D2391F72495BC8000392A4E /* SecondViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SecondViewController.h; sourceTree = ""; }; 43 | 3D2391F82495BC8000392A4E /* SecondViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SecondViewController.m; sourceTree = ""; }; 44 | 3D66F6DB2484AB4000E7EF78 /* JRDropMenuDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JRDropMenuDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 3D66F6DE2484AB4000E7EF78 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 46 | 3D66F6DF2484AB4000E7EF78 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 47 | 3D66F6E42484AB4000E7EF78 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 48 | 3D66F6E52484AB4000E7EF78 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 49 | 3D66F6E82484AB4000E7EF78 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 3D66F6EA2484AB4200E7EF78 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 51 | 3D66F6ED2484AB4200E7EF78 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 52 | 3D66F6EF2484AB4200E7EF78 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 3D66F6F02484AB4200E7EF78 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 54 | 3D66F6F82484ABAD00E7EF78 /* JRDropMenuView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JRDropMenuView.h; sourceTree = ""; }; 55 | 3D66F6F92484ABAD00E7EF78 /* JRDropMenuView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JRDropMenuView.m; sourceTree = ""; }; 56 | 3D66F6FB2484AEE800E7EF78 /* JRDropTitleItemView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JRDropTitleItemView.h; sourceTree = ""; }; 57 | 3D66F6FC2484AEE800E7EF78 /* JRDropTitleItemView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JRDropTitleItemView.m; sourceTree = ""; }; 58 | 3D66F6FE2484B18E00E7EF78 /* JRDropMenuItemModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JRDropMenuItemModel.h; sourceTree = ""; }; 59 | 3D66F6FF2484B18E00E7EF78 /* JRDropMenuItemModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JRDropMenuItemModel.m; sourceTree = ""; }; 60 | 3D66F7042484B4E300E7EF78 /* JRDropMenuCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JRDropMenuCell.h; sourceTree = ""; }; 61 | 3D66F7052484B4E300E7EF78 /* JRDropMenuCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JRDropMenuCell.m; sourceTree = ""; }; 62 | 3D66F7062484B4E300E7EF78 /* JRDropMenuCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = JRDropMenuCell.xib; sourceTree = ""; }; 63 | 3D68BB65249A08F9006D0203 /* JRDropAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = JRDropAssets.xcassets; sourceTree = ""; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | 3D66F6D82484AB4000E7EF78 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | 3D66F6D22484AB4000E7EF78 = { 78 | isa = PBXGroup; 79 | children = ( 80 | 3D66F6DD2484AB4000E7EF78 /* JRDropMenuDemo */, 81 | 3D66F6DC2484AB4000E7EF78 /* Products */, 82 | ); 83 | sourceTree = ""; 84 | }; 85 | 3D66F6DC2484AB4000E7EF78 /* Products */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 3D66F6DB2484AB4000E7EF78 /* JRDropMenuDemo.app */, 89 | ); 90 | name = Products; 91 | sourceTree = ""; 92 | }; 93 | 3D66F6DD2484AB4000E7EF78 /* JRDropMenuDemo */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 3D66F6DE2484AB4000E7EF78 /* AppDelegate.h */, 97 | 3D66F6DF2484AB4000E7EF78 /* AppDelegate.m */, 98 | 3D66F6E42484AB4000E7EF78 /* ViewController.h */, 99 | 3D66F6E52484AB4000E7EF78 /* ViewController.m */, 100 | 3D2391F42495BC7600392A4E /* FirstViewController.h */, 101 | 3D2391F52495BC7600392A4E /* FirstViewController.m */, 102 | 3D2391F72495BC8000392A4E /* SecondViewController.h */, 103 | 3D2391F82495BC8000392A4E /* SecondViewController.m */, 104 | 3D66F6E72484AB4000E7EF78 /* Main.storyboard */, 105 | 3D66F6EA2484AB4200E7EF78 /* Assets.xcassets */, 106 | 3D66F6EC2484AB4200E7EF78 /* LaunchScreen.storyboard */, 107 | 3D66F6EF2484AB4200E7EF78 /* Info.plist */, 108 | 3D66F6F02484AB4200E7EF78 /* main.m */, 109 | 3D66F6F72484AB7900E7EF78 /* JRDropMenu */, 110 | ); 111 | path = JRDropMenuDemo; 112 | sourceTree = ""; 113 | }; 114 | 3D66F6F72484AB7900E7EF78 /* JRDropMenu */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 3D66F6F82484ABAD00E7EF78 /* JRDropMenuView.h */, 118 | 3D66F6F92484ABAD00E7EF78 /* JRDropMenuView.m */, 119 | 3D66F6FB2484AEE800E7EF78 /* JRDropTitleItemView.h */, 120 | 3D66F6FC2484AEE800E7EF78 /* JRDropTitleItemView.m */, 121 | 3D66F7042484B4E300E7EF78 /* JRDropMenuCell.h */, 122 | 3D66F7052484B4E300E7EF78 /* JRDropMenuCell.m */, 123 | 3D66F7062484B4E300E7EF78 /* JRDropMenuCell.xib */, 124 | 3D66F6FE2484B18E00E7EF78 /* JRDropMenuItemModel.h */, 125 | 3D66F6FF2484B18E00E7EF78 /* JRDropMenuItemModel.m */, 126 | 3D2391CD2493266600392A4E /* JROption.h */, 127 | 3D2391CE2493266600392A4E /* JROption.m */, 128 | 3D2391D62494FD0C00392A4E /* JRCategory.h */, 129 | 3D2391D72494FD0C00392A4E /* JRCategory.m */, 130 | 3D2391D024932E4F00392A4E /* JRTitle.h */, 131 | 3D2391D124932E4F00392A4E /* JRTitle.m */, 132 | 3D2391D324932FA500392A4E /* JRList.h */, 133 | 3D2391D424932FA500392A4E /* JRList.m */, 134 | 3D2391CC2493232600392A4E /* JRGlobalMacro.h */, 135 | 3D68BB65249A08F9006D0203 /* JRDropAssets.xcassets */, 136 | ); 137 | path = JRDropMenu; 138 | sourceTree = ""; 139 | }; 140 | /* End PBXGroup section */ 141 | 142 | /* Begin PBXNativeTarget section */ 143 | 3D66F6DA2484AB4000E7EF78 /* JRDropMenuDemo */ = { 144 | isa = PBXNativeTarget; 145 | buildConfigurationList = 3D66F6F42484AB4200E7EF78 /* Build configuration list for PBXNativeTarget "JRDropMenuDemo" */; 146 | buildPhases = ( 147 | 3D66F6D72484AB4000E7EF78 /* Sources */, 148 | 3D66F6D82484AB4000E7EF78 /* Frameworks */, 149 | 3D66F6D92484AB4000E7EF78 /* Resources */, 150 | ); 151 | buildRules = ( 152 | ); 153 | dependencies = ( 154 | ); 155 | name = JRDropMenuDemo; 156 | productName = JRDropMenuDemo; 157 | productReference = 3D66F6DB2484AB4000E7EF78 /* JRDropMenuDemo.app */; 158 | productType = "com.apple.product-type.application"; 159 | }; 160 | /* End PBXNativeTarget section */ 161 | 162 | /* Begin PBXProject section */ 163 | 3D66F6D32484AB4000E7EF78 /* Project object */ = { 164 | isa = PBXProject; 165 | attributes = { 166 | LastUpgradeCheck = 1150; 167 | ORGANIZATIONNAME = Imaritime; 168 | TargetAttributes = { 169 | 3D66F6DA2484AB4000E7EF78 = { 170 | CreatedOnToolsVersion = 11.5; 171 | }; 172 | }; 173 | }; 174 | buildConfigurationList = 3D66F6D62484AB4000E7EF78 /* Build configuration list for PBXProject "JRDropMenuDemo" */; 175 | compatibilityVersion = "Xcode 9.3"; 176 | developmentRegion = en; 177 | hasScannedForEncodings = 0; 178 | knownRegions = ( 179 | en, 180 | Base, 181 | ); 182 | mainGroup = 3D66F6D22484AB4000E7EF78; 183 | productRefGroup = 3D66F6DC2484AB4000E7EF78 /* Products */; 184 | projectDirPath = ""; 185 | projectRoot = ""; 186 | targets = ( 187 | 3D66F6DA2484AB4000E7EF78 /* JRDropMenuDemo */, 188 | ); 189 | }; 190 | /* End PBXProject section */ 191 | 192 | /* Begin PBXResourcesBuildPhase section */ 193 | 3D66F6D92484AB4000E7EF78 /* Resources */ = { 194 | isa = PBXResourcesBuildPhase; 195 | buildActionMask = 2147483647; 196 | files = ( 197 | 3D66F6EE2484AB4200E7EF78 /* LaunchScreen.storyboard in Resources */, 198 | 3D66F7082484B4E300E7EF78 /* JRDropMenuCell.xib in Resources */, 199 | 3D66F6EB2484AB4200E7EF78 /* Assets.xcassets in Resources */, 200 | 3D66F6E92484AB4000E7EF78 /* Main.storyboard in Resources */, 201 | 3D68BB66249A08F9006D0203 /* JRDropAssets.xcassets in Resources */, 202 | ); 203 | runOnlyForDeploymentPostprocessing = 0; 204 | }; 205 | /* End PBXResourcesBuildPhase section */ 206 | 207 | /* Begin PBXSourcesBuildPhase section */ 208 | 3D66F6D72484AB4000E7EF78 /* Sources */ = { 209 | isa = PBXSourcesBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | 3D66F6E62484AB4000E7EF78 /* ViewController.m in Sources */, 213 | 3D2391F92495BC8000392A4E /* SecondViewController.m in Sources */, 214 | 3D66F6FD2484AEE800E7EF78 /* JRDropTitleItemView.m in Sources */, 215 | 3D2391D524932FA500392A4E /* JRList.m in Sources */, 216 | 3D66F6E02484AB4000E7EF78 /* AppDelegate.m in Sources */, 217 | 3D2391D224932E4F00392A4E /* JRTitle.m in Sources */, 218 | 3D66F6F12484AB4200E7EF78 /* main.m in Sources */, 219 | 3D2391CF2493266600392A4E /* JROption.m in Sources */, 220 | 3D2391F62495BC7600392A4E /* FirstViewController.m in Sources */, 221 | 3D66F6FA2484ABAD00E7EF78 /* JRDropMenuView.m in Sources */, 222 | 3D2391D82494FD0C00392A4E /* JRCategory.m in Sources */, 223 | 3D66F7002484B18E00E7EF78 /* JRDropMenuItemModel.m in Sources */, 224 | 3D66F7072484B4E300E7EF78 /* JRDropMenuCell.m in Sources */, 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | /* End PBXSourcesBuildPhase section */ 229 | 230 | /* Begin PBXVariantGroup section */ 231 | 3D66F6E72484AB4000E7EF78 /* Main.storyboard */ = { 232 | isa = PBXVariantGroup; 233 | children = ( 234 | 3D66F6E82484AB4000E7EF78 /* Base */, 235 | ); 236 | name = Main.storyboard; 237 | sourceTree = ""; 238 | }; 239 | 3D66F6EC2484AB4200E7EF78 /* LaunchScreen.storyboard */ = { 240 | isa = PBXVariantGroup; 241 | children = ( 242 | 3D66F6ED2484AB4200E7EF78 /* Base */, 243 | ); 244 | name = LaunchScreen.storyboard; 245 | sourceTree = ""; 246 | }; 247 | /* End PBXVariantGroup section */ 248 | 249 | /* Begin XCBuildConfiguration section */ 250 | 3D66F6F22484AB4200E7EF78 /* Debug */ = { 251 | isa = XCBuildConfiguration; 252 | buildSettings = { 253 | ALWAYS_SEARCH_USER_PATHS = NO; 254 | CLANG_ANALYZER_NONNULL = YES; 255 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 256 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 257 | CLANG_CXX_LIBRARY = "libc++"; 258 | CLANG_ENABLE_MODULES = YES; 259 | CLANG_ENABLE_OBJC_ARC = YES; 260 | CLANG_ENABLE_OBJC_WEAK = YES; 261 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 262 | CLANG_WARN_BOOL_CONVERSION = YES; 263 | CLANG_WARN_COMMA = YES; 264 | CLANG_WARN_CONSTANT_CONVERSION = YES; 265 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 266 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 267 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 268 | CLANG_WARN_EMPTY_BODY = YES; 269 | CLANG_WARN_ENUM_CONVERSION = YES; 270 | CLANG_WARN_INFINITE_RECURSION = YES; 271 | CLANG_WARN_INT_CONVERSION = YES; 272 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 273 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 274 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 275 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 276 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 277 | CLANG_WARN_STRICT_PROTOTYPES = YES; 278 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 279 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 280 | CLANG_WARN_UNREACHABLE_CODE = YES; 281 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 282 | COPY_PHASE_STRIP = NO; 283 | DEBUG_INFORMATION_FORMAT = dwarf; 284 | ENABLE_STRICT_OBJC_MSGSEND = YES; 285 | ENABLE_TESTABILITY = YES; 286 | GCC_C_LANGUAGE_STANDARD = gnu11; 287 | GCC_DYNAMIC_NO_PIC = NO; 288 | GCC_NO_COMMON_BLOCKS = YES; 289 | GCC_OPTIMIZATION_LEVEL = 0; 290 | GCC_PREPROCESSOR_DEFINITIONS = ( 291 | "DEBUG=1", 292 | "$(inherited)", 293 | ); 294 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 295 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 296 | GCC_WARN_UNDECLARED_SELECTOR = YES; 297 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 298 | GCC_WARN_UNUSED_FUNCTION = YES; 299 | GCC_WARN_UNUSED_VARIABLE = YES; 300 | IPHONEOS_DEPLOYMENT_TARGET = 13.5; 301 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 302 | MTL_FAST_MATH = YES; 303 | ONLY_ACTIVE_ARCH = YES; 304 | SDKROOT = iphoneos; 305 | }; 306 | name = Debug; 307 | }; 308 | 3D66F6F32484AB4200E7EF78 /* Release */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | ALWAYS_SEARCH_USER_PATHS = NO; 312 | CLANG_ANALYZER_NONNULL = YES; 313 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 314 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 315 | CLANG_CXX_LIBRARY = "libc++"; 316 | CLANG_ENABLE_MODULES = YES; 317 | CLANG_ENABLE_OBJC_ARC = YES; 318 | CLANG_ENABLE_OBJC_WEAK = YES; 319 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 320 | CLANG_WARN_BOOL_CONVERSION = YES; 321 | CLANG_WARN_COMMA = YES; 322 | CLANG_WARN_CONSTANT_CONVERSION = YES; 323 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 324 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 325 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 326 | CLANG_WARN_EMPTY_BODY = YES; 327 | CLANG_WARN_ENUM_CONVERSION = YES; 328 | CLANG_WARN_INFINITE_RECURSION = YES; 329 | CLANG_WARN_INT_CONVERSION = YES; 330 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 331 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 332 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 333 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 334 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 335 | CLANG_WARN_STRICT_PROTOTYPES = YES; 336 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 337 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 338 | CLANG_WARN_UNREACHABLE_CODE = YES; 339 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 340 | COPY_PHASE_STRIP = NO; 341 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 342 | ENABLE_NS_ASSERTIONS = NO; 343 | ENABLE_STRICT_OBJC_MSGSEND = YES; 344 | GCC_C_LANGUAGE_STANDARD = gnu11; 345 | GCC_NO_COMMON_BLOCKS = YES; 346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 348 | GCC_WARN_UNDECLARED_SELECTOR = YES; 349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 350 | GCC_WARN_UNUSED_FUNCTION = YES; 351 | GCC_WARN_UNUSED_VARIABLE = YES; 352 | IPHONEOS_DEPLOYMENT_TARGET = 13.5; 353 | MTL_ENABLE_DEBUG_INFO = NO; 354 | MTL_FAST_MATH = YES; 355 | SDKROOT = iphoneos; 356 | VALIDATE_PRODUCT = YES; 357 | }; 358 | name = Release; 359 | }; 360 | 3D66F6F52484AB4200E7EF78 /* Debug */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 364 | CODE_SIGN_STYLE = Automatic; 365 | DEVELOPMENT_TEAM = 5UK7P892DU; 366 | INFOPLIST_FILE = JRDropMenuDemo/Info.plist; 367 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 368 | LD_RUNPATH_SEARCH_PATHS = ( 369 | "$(inherited)", 370 | "@executable_path/Frameworks", 371 | ); 372 | PRODUCT_BUNDLE_IDENTIFIER = com.imaritime.www.JRDropMenuDemo; 373 | PRODUCT_NAME = "$(TARGET_NAME)"; 374 | TARGETED_DEVICE_FAMILY = "1,2"; 375 | }; 376 | name = Debug; 377 | }; 378 | 3D66F6F62484AB4200E7EF78 /* Release */ = { 379 | isa = XCBuildConfiguration; 380 | buildSettings = { 381 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 382 | CODE_SIGN_STYLE = Automatic; 383 | DEVELOPMENT_TEAM = 5UK7P892DU; 384 | INFOPLIST_FILE = JRDropMenuDemo/Info.plist; 385 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 386 | LD_RUNPATH_SEARCH_PATHS = ( 387 | "$(inherited)", 388 | "@executable_path/Frameworks", 389 | ); 390 | PRODUCT_BUNDLE_IDENTIFIER = com.imaritime.www.JRDropMenuDemo; 391 | PRODUCT_NAME = "$(TARGET_NAME)"; 392 | TARGETED_DEVICE_FAMILY = "1,2"; 393 | }; 394 | name = Release; 395 | }; 396 | /* End XCBuildConfiguration section */ 397 | 398 | /* Begin XCConfigurationList section */ 399 | 3D66F6D62484AB4000E7EF78 /* Build configuration list for PBXProject "JRDropMenuDemo" */ = { 400 | isa = XCConfigurationList; 401 | buildConfigurations = ( 402 | 3D66F6F22484AB4200E7EF78 /* Debug */, 403 | 3D66F6F32484AB4200E7EF78 /* Release */, 404 | ); 405 | defaultConfigurationIsVisible = 0; 406 | defaultConfigurationName = Release; 407 | }; 408 | 3D66F6F42484AB4200E7EF78 /* Build configuration list for PBXNativeTarget "JRDropMenuDemo" */ = { 409 | isa = XCConfigurationList; 410 | buildConfigurations = ( 411 | 3D66F6F52484AB4200E7EF78 /* Debug */, 412 | 3D66F6F62484AB4200E7EF78 /* Release */, 413 | ); 414 | defaultConfigurationIsVisible = 0; 415 | defaultConfigurationName = Release; 416 | }; 417 | /* End XCConfigurationList section */ 418 | }; 419 | rootObject = 3D66F6D32484AB4000E7EF78 /* Project object */; 420 | } 421 | -------------------------------------------------------------------------------- /JRDropMenuDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JRDropMenuDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /JRDropMenuDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic ,strong) UIWindow * window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /JRDropMenuDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | // Override point for customization after application launch. 21 | 22 | 23 | return YES; 24 | } 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /JRDropMenuDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /JRDropMenuDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /JRDropMenuDemo/Assets.xcassets/checkMark.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "checkMark@2x.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "filename" : "checkMark@3x.png", 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "author" : "xcode", 20 | "version" : 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JRDropMenuDemo/Assets.xcassets/checkMark.imageset/checkMark@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/JRDropMenuDemo/Assets.xcassets/checkMark.imageset/checkMark@2x.png -------------------------------------------------------------------------------- /JRDropMenuDemo/Assets.xcassets/checkMark.imageset/checkMark@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/JRDropMenuDemo/Assets.xcassets/checkMark.imageset/checkMark@3x.png -------------------------------------------------------------------------------- /JRDropMenuDemo/Assets.xcassets/down_arrow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "down_arrow@2x.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "filename" : "down_arrow@3x.png", 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "author" : "xcode", 20 | "version" : 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JRDropMenuDemo/Assets.xcassets/down_arrow.imageset/down_arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/JRDropMenuDemo/Assets.xcassets/down_arrow.imageset/down_arrow@2x.png -------------------------------------------------------------------------------- /JRDropMenuDemo/Assets.xcassets/down_arrow.imageset/down_arrow@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/JRDropMenuDemo/Assets.xcassets/down_arrow.imageset/down_arrow@3x.png -------------------------------------------------------------------------------- /JRDropMenuDemo/Assets.xcassets/up_arrow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "up_arrow@2x.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "filename" : "up_arrow@3x.png", 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "author" : "xcode", 20 | "version" : 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JRDropMenuDemo/Assets.xcassets/up_arrow.imageset/up_arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/JRDropMenuDemo/Assets.xcassets/up_arrow.imageset/up_arrow@2x.png -------------------------------------------------------------------------------- /JRDropMenuDemo/Assets.xcassets/up_arrow.imageset/up_arrow@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/JRDropMenuDemo/Assets.xcassets/up_arrow.imageset/up_arrow@3x.png -------------------------------------------------------------------------------- /JRDropMenuDemo/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 | -------------------------------------------------------------------------------- /JRDropMenuDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /JRDropMenuDemo/FirstViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FirstViewController.h 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/14. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface FirstViewController : UIViewController 14 | 15 | @property (weak, nonatomic) IBOutlet UITableView *tableView; 16 | 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /JRDropMenuDemo/FirstViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FirstViewController.m 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/14. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import "FirstViewController.h" 10 | #import "SecondViewController.h" 11 | #import "JRDropMenuView.h" 12 | 13 | @interface FirstViewController () 14 | 15 | @property (nonatomic , copy) NSArray * arr; 16 | 17 | @end 18 | 19 | @implementation FirstViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | // Do any additional setup after loading the view. 24 | 25 | self.arr = @[@"标题有前缀",@"默认选中项",@"多列展示",@"自定义标题样式",@"自定义列表样式",@"设置选中不替换标题Index"]; 26 | 27 | } 28 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 29 | { 30 | return self.arr.count; 31 | } 32 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 33 | { 34 | UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; 35 | cell.textLabel.text = self.arr[indexPath.row]; 36 | return cell; 37 | } 38 | 39 | #pragma mark - Navigation 40 | 41 | // In a storyboard-based application, you will often want to do a little preparation before navigation 42 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 43 | // Get the new view controller using [segue destinationViewController]. 44 | // Pass the selected object to the new view controller. 45 | 46 | //获取当前点击的cell的IndexPath 47 | NSIndexPath *indexPath = [_tableView indexPathForSelectedRow]; 48 | 49 | SecondViewController * second = (SecondViewController *)segue.destinationViewController; 50 | second.menuType = indexPath.row; 51 | 52 | } 53 | 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /JRDropMenuDemo/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 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 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 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // JRCategory.h 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/13. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JRTitle.h" 11 | #import "JRList.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface JRCategory : NSObject 16 | 17 | /// 标题 18 | JRPropStatementAndPropSetFuncStatement(strong, JRCategory, JRTitle *, title); 19 | /// 列表 20 | JRPropStatementAndPropSetFuncStatement(strong, JRCategory, JRList *, list); 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRCategory.m: -------------------------------------------------------------------------------- 1 | // 2 | // JRCategory.m 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/13. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import "JRCategory.h" 10 | 11 | @implementation JRCategory 12 | 13 | -(instancetype)init 14 | { 15 | self = [super init]; 16 | if (self) { 17 | _title = JRTitle.new; 18 | _list = JRList.new; 19 | } 20 | return self; 21 | } 22 | 23 | JRPropSetFuncImplementation(JRCategory, JRTitle *, title); 24 | JRPropSetFuncImplementation(JRCategory, JRList *, list); 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/checkMark.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "checkMark@2x.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "filename" : "checkMark@3x.png", 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "author" : "xcode", 20 | "version" : 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/checkMark.imageset/checkMark@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/checkMark.imageset/checkMark@2x.png -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/checkMark.imageset/checkMark@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/checkMark.imageset/checkMark@3x.png -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/down_arrow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "down_arrow@2x.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "filename" : "down_arrow@3x.png", 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "author" : "xcode", 20 | "version" : 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/down_arrow.imageset/down_arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/down_arrow.imageset/down_arrow@2x.png -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/down_arrow.imageset/down_arrow@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/down_arrow.imageset/down_arrow@3x.png -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/up_arrow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "up_arrow@2x.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "filename" : "up_arrow@3x.png", 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "author" : "xcode", 20 | "version" : 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/up_arrow.imageset/up_arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/up_arrow.imageset/up_arrow@2x.png -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/up_arrow.imageset/up_arrow@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/JRDropMenuDemo/JRDropMenu/JRDropAssets.xcassets/up_arrow.imageset/up_arrow@3x.png -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropMenuCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // JRDropMenuCell.h 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JRDropMenuItemModel.h" 11 | #import "JROption.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface JRDropMenuCell : UITableViewCell 16 | 17 | @property (weak, nonatomic) IBOutlet UILabel *titleLabel; 18 | @property (weak, nonatomic) IBOutlet UIImageView *checkMarkImg; 19 | @property (weak, nonatomic) IBOutlet UIView *dividingLine; 20 | 21 | 22 | @property (nonatomic , strong) JRList * list; 23 | 24 | @property (nonatomic , strong) JRDropMenuItemModel * model; 25 | 26 | @end 27 | 28 | NS_ASSUME_NONNULL_END 29 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropMenuCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // JRDropMenuCell.m 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import "JRDropMenuCell.h" 10 | 11 | @implementation JRDropMenuCell 12 | 13 | - (void)awakeFromNib { 14 | [super awakeFromNib]; 15 | // Initialization code 16 | } 17 | 18 | -(void)setModel:(JRDropMenuItemModel *)model 19 | { 20 | _model = model; 21 | 22 | _titleLabel.text = model.title; 23 | _checkMarkImg.image = self.list.listSelectedImage; 24 | 25 | if (model.isSelected) { 26 | self.backgroundColor = self.list.listSelectedBgColor; 27 | _titleLabel.textColor = self.list.listSelectedTintColor; 28 | _checkMarkImg.hidden = NO; 29 | }else{ 30 | self.backgroundColor = self.list.listNormalBgColor; 31 | _titleLabel.textColor = self.list.listNormalTintColor; 32 | _checkMarkImg.hidden = YES; 33 | } 34 | 35 | } 36 | 37 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 38 | [super setSelected:selected animated:animated]; 39 | 40 | // Configure the view for the selected state 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropMenuCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 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 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropMenuItemModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // JRDropMenuItemModel.h 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface JRDropMenuItemModel : NSObject 15 | 16 | @property (nonatomic , copy) NSString * title; 17 | @property (nonatomic , assign) BOOL isSelected; 18 | @property (nonatomic , assign) NSInteger index; 19 | 20 | @property (nonatomic , assign) BOOL shouldShowOriginTitle; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropMenuItemModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // JRDropMenuItemModel.m 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import "JRDropMenuItemModel.h" 10 | 11 | @implementation JRDropMenuItemModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropMenuView.h: -------------------------------------------------------------------------------- 1 | // 2 | // JRDropMenuView.h 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "JRDropMenuItemModel.h" 12 | #import "JRDropTitleItemView.h" 13 | #import "JROption.h" 14 | 15 | @class JRDropMenuView; 16 | 17 | NS_ASSUME_NONNULL_BEGIN 18 | 19 | @protocol JRDropMenuDelegate 20 | 21 | - (void)jrDropMenuView:(JRDropMenuView *)jrDropMenuView ResultArr:(NSMutableArray *)resultArr; 22 | 23 | @end 24 | 25 | @interface JRDropMenuView : UIView 26 | 27 | 28 | @property (nonatomic , weak) iddelegate; 29 | 30 | @property (nonatomic , strong) UIStackView * stackView;//标题stackView 31 | @property (nonatomic , strong) UITableView * listTable; 32 | @property (nonatomic , strong) UIView * bottomIndicator; 33 | @property (nonatomic , strong) UIView * bottomSeparatLine; 34 | @property (nonatomic , strong) UIView * maskBgView; 35 | 36 | @property (nonatomic , strong) JROption * jrOption; 37 | 38 | - (void)createJRDropMenuViewWithOption:(JROption *)option; 39 | 40 | //刷新数据 41 | - (void)reloadData; 42 | /// 收回tableview 43 | /// @param animation 是否需要动画 44 | - (void)dismissWithAnimation:(BOOL)animation; 45 | 46 | @end 47 | 48 | NS_ASSUME_NONNULL_END 49 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropMenuView.m: -------------------------------------------------------------------------------- 1 | // 2 | // JRDropMenuView.m 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import "JRDropMenuView.h" 10 | #import "JRDropMenuCell.h" 11 | 12 | static float titleWidth; 13 | static float titleHeight; 14 | 15 | @interface JRDropMenuView() 16 | 17 | @property (nonatomic , strong) NSMutableArray * subViews;//标题views 18 | @property (nonatomic , strong) NSMutableArray * titlesArr;//标题数组 19 | @property (nonatomic , strong) NSMutableArray * itemsArr;//当前列表数组 20 | @property (nonatomic , assign) NSInteger curIndex; 21 | @property (nonatomic , strong) NSMutableArray * columnContentArr;//每列数据 22 | @property (nonatomic , strong) NSMutableArray * resultArr;//结果数组 23 | 24 | @end 25 | 26 | 27 | @implementation JRDropMenuView 28 | 29 | - (void)createJRDropMenuViewWithOption:(JROption *)option 30 | { 31 | self.jrOption = option; 32 | 33 | if (option.cornerRadius) { 34 | self.layer.cornerRadius = option.cornerRadius; 35 | self.layer.masksToBounds = YES; 36 | } 37 | self.curIndex = -1; 38 | 39 | [self reloadData]; 40 | } 41 | - (void)reloadData 42 | { 43 | [self.subViews removeAllObjects]; 44 | [self.resultArr removeAllObjects]; 45 | [self.columnContentArr removeAllObjects]; 46 | 47 | titleWidth = self.frame.size.width/self.jrOption.categoryArr.count; 48 | titleHeight = self.frame.size.height; 49 | 50 | for (int i = 0; i < self.jrOption.categoryArr.count; i++) { 51 | //设置标题 52 | JRCategory * category = self.jrOption.categoryArr[i]; 53 | JRTitle * title = category.title; 54 | JRList * list = category.list; 55 | 56 | JRDropTitleItemView * itemView = [[JRDropTitleItemView alloc] initWithFrame:CGRectMake(0, 0, titleWidth, titleHeight)]; 57 | itemView.title = title; 58 | if (title.defaultIndex != 0) {//默认选中 59 | [itemView setText:list.listArr[title.defaultIndex]]; 60 | }else{ 61 | [itemView setText:title.titleName]; 62 | } 63 | itemView.delegate = self; 64 | [self.subViews addObject:itemView]; 65 | 66 | //结果数组 67 | JRDropMenuItemModel * resultModel = [JRDropMenuItemModel new]; 68 | resultModel.title = list.listArr[title.defaultIndex]; 69 | resultModel.index = title.defaultIndex; 70 | [self.resultArr addObject:resultModel]; 71 | 72 | //设置列表 73 | NSMutableArray * contentArr = [NSMutableArray array]; 74 | for (int j = 0; j < list.listArr.count; j++){//重置当前列表数据 75 | JRDropMenuItemModel * model = [JRDropMenuItemModel new]; 76 | model.title = list.listArr[j]; 77 | model.index = j; 78 | model.isSelected = NO; 79 | if ([category.list.showOriginTitleIndexArr containsObject:@(j)]) { 80 | model.shouldShowOriginTitle = YES; 81 | }else{ 82 | model.shouldShowOriginTitle = NO; 83 | } 84 | JRDropMenuItemModel * curResultModel = _resultArr[i]; 85 | if (curResultModel.index == j) { 86 | model.isSelected = YES; 87 | } 88 | [contentArr addObject:model]; 89 | } 90 | [self.columnContentArr addObject:contentArr]; 91 | } 92 | 93 | [self setupTitleStackView];//配置标题stackView 94 | 95 | } 96 | - (void)setupTitleStackView 97 | { 98 | if (self.stackView.superview) { 99 | [self.stackView removeFromSuperview]; 100 | } 101 | self.stackView = [[UIStackView alloc] initWithArrangedSubviews:self.subViews]; 102 | _stackView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height); 103 | _stackView.axis = UILayoutConstraintAxisHorizontal; 104 | _stackView.spacing = .1; 105 | _stackView.distribution = UIStackViewDistributionFillEqually; 106 | 107 | [self addSubview:_stackView]; 108 | if (self.jrOption.showIndicator) { 109 | if (self.bottomIndicator.superview) { 110 | [self.bottomIndicator removeFromSuperview]; 111 | } 112 | [self addSubview:self.bottomIndicator]; 113 | } 114 | if (self.jrOption.showBottomLine) { 115 | if (self.bottomSeparatLine.superview) { 116 | [self.bottomSeparatLine removeFromSuperview]; 117 | } 118 | [self addSubview:self.bottomSeparatLine]; 119 | } 120 | } 121 | - (void)setupTableView 122 | { 123 | if (self.maskBgView.superview == nil) { 124 | [[UIApplication sharedApplication].keyWindow addSubview:self.maskBgView]; 125 | } 126 | if (self.listTable.superview == nil) { 127 | [[UIApplication sharedApplication].keyWindow addSubview:self.listTable]; 128 | } 129 | } 130 | - (void)show 131 | { 132 | [self setupTableView];//配置tableview 133 | 134 | if (self.bottomIndicator.isHidden) { 135 | self.bottomIndicator.hidden = NO; 136 | self.bottomIndicator.frame = CGRectMake(_curIndex * titleWidth + 10, titleHeight - 1 - self.jrOption.indicatorHeight, titleWidth - 20, self.jrOption.indicatorHeight); 137 | } 138 | self.maskBgView.hidden = NO; 139 | [UIView animateWithDuration:.25 animations:^{ 140 | self.bottomIndicator.frame = CGRectMake(self.curIndex * titleWidth + 10, titleHeight - 1 - self.jrOption.indicatorHeight, titleWidth - 20, self.jrOption.indicatorHeight); 141 | 142 | JRCategory * category = self.jrOption.categoryArr[self.curIndex]; 143 | self.listTable.frame = CGRectMake(self.frame.origin.x, CGRectGetMaxY(self.frame), self.frame.size.width, category.list.listRowHeight * self.itemsArr.count); 144 | self.maskBgView.alpha = 1; 145 | 146 | } completion:^(BOOL finished) { 147 | 148 | }]; 149 | } 150 | - (void)dismissWithAnimation:(BOOL)animation 151 | { 152 | if (_curIndex != -1) { 153 | JRDropTitleItemView * lastView = self.subViews[_curIndex]; 154 | lastView.isSelected = NO; 155 | } 156 | 157 | _curIndex = -1; 158 | self.bottomIndicator.hidden = YES; 159 | 160 | if (animation) { 161 | [UIView animateWithDuration:.25 animations:^{ 162 | self.listTable.frame = CGRectMake(self.frame.origin.x, CGRectGetMaxY(self.frame), self.frame.size.width, 0); 163 | 164 | self.maskBgView.alpha = 0; 165 | } completion:^(BOOL finished) { 166 | self.maskBgView.hidden = YES; 167 | }]; 168 | }else{ 169 | self.listTable.frame = CGRectMake(self.frame.origin.x, CGRectGetMaxY(self.frame), self.frame.size.width, 0); 170 | self.maskBgView.hidden = YES; 171 | } 172 | 173 | } 174 | #pragma mark - DataSource 175 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 176 | { 177 | if (self.curIndex >= 0) { 178 | JRCategory * category = self.jrOption.categoryArr[self.curIndex]; 179 | return category.list.listRowHeight; 180 | } 181 | return 0; 182 | } 183 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 184 | { 185 | if (self.curIndex >= 0) { 186 | JRCategory * category = self.jrOption.categoryArr[self.curIndex]; 187 | return category.list.listArr.count; 188 | } 189 | return 0; 190 | } 191 | #pragma mark - Delegate 192 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 193 | { 194 | JRCategory * category = self.jrOption.categoryArr[self.curIndex]; 195 | 196 | JRDropMenuCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([JRDropMenuCell class])]; 197 | cell.list = category.list; 198 | cell.model = self.itemsArr[indexPath.row]; 199 | return cell; 200 | } 201 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 202 | { 203 | JRDropMenuItemModel * lastModel = self.resultArr[_curIndex]; 204 | if (lastModel.index == indexPath.row) {//点击的为之前选中的item 205 | [self dismissWithAnimation:YES]; 206 | return; 207 | } 208 | 209 | JRDropMenuItemModel * model = self.itemsArr[indexPath.row]; 210 | model.isSelected = YES; 211 | 212 | JRDropMenuItemModel * lastListModel = self.itemsArr[lastModel.index]; 213 | lastListModel.isSelected = NO; 214 | 215 | self.resultArr[_curIndex] = model;//记录结果 216 | 217 | JRDropTitleItemView * titleView = self.subViews[_curIndex]; 218 | NSString * titleStr; 219 | if (model.shouldShowOriginTitle) { 220 | JRCategory * category = self.jrOption.categoryArr[self.curIndex]; 221 | titleStr = category.title.titleName; 222 | }else{ 223 | titleStr = model.title; 224 | } 225 | [titleView setText:titleStr]; 226 | 227 | [self.listTable reloadData]; 228 | 229 | [self dismissWithAnimation:YES]; 230 | 231 | if (self.delegate && [self.delegate respondsToSelector:@selector(jrDropMenuView:ResultArr:)]) { 232 | [self.delegate jrDropMenuView:self ResultArr:self.resultArr]; 233 | } 234 | } 235 | #pragma mark - JRDropTitleItemViewDelegate 236 | - (void)didClickTitleInJRDropTitleItemView:(JRDropTitleItemView *)itemView 237 | { 238 | if (_curIndex != -1) { 239 | JRDropTitleItemView * lastView = self.subViews[_curIndex]; 240 | lastView.isSelected = NO; 241 | } 242 | 243 | NSInteger curIndex = [self.subViews indexOfObject:itemView]; 244 | 245 | if (curIndex == _curIndex) { //收回 246 | [self dismissWithAnimation:YES]; 247 | return; 248 | }else{ 249 | _curIndex = curIndex; 250 | } 251 | 252 | [self.itemsArr removeAllObjects]; 253 | self.itemsArr = [NSMutableArray arrayWithArray:self.columnContentArr[_curIndex]]; 254 | 255 | [self.listTable reloadData]; 256 | 257 | [self show]; 258 | } 259 | -(NSMutableArray *)subViews 260 | { 261 | if (!_subViews) { 262 | _subViews = [NSMutableArray array]; 263 | } 264 | return _subViews; 265 | } 266 | -(NSMutableArray *)itemsArr 267 | { 268 | if (!_itemsArr) { 269 | _itemsArr = [NSMutableArray array]; 270 | } 271 | return _itemsArr; 272 | } 273 | -(NSMutableArray *)columnContentArr 274 | { 275 | if (!_columnContentArr) { 276 | _columnContentArr = [NSMutableArray array]; 277 | } 278 | return _columnContentArr; 279 | } 280 | -(NSMutableArray *)resultArr 281 | { 282 | if (!_resultArr) { 283 | _resultArr = [NSMutableArray array]; 284 | } 285 | return _resultArr; 286 | } 287 | -(UITableView *)listTable 288 | { 289 | if (!_listTable) { 290 | 291 | _listTable = [[UITableView alloc] initWithFrame:CGRectMake(self.frame.origin.x, CGRectGetMaxY(self.frame), self.frame.size.width, 0) style:UITableViewStylePlain]; 292 | _listTable.separatorStyle = UITableViewCellSeparatorStyleNone; 293 | _listTable.dataSource = self; 294 | _listTable.delegate = self; 295 | _listTable.showsVerticalScrollIndicator = NO; 296 | NSBundle * bundle = [NSBundle bundleForClass:[JRDropMenuCell class]]; 297 | [_listTable registerNib:[UINib nibWithNibName:NSStringFromClass([JRDropMenuCell class]) bundle:bundle]forCellReuseIdentifier: NSStringFromClass([JRDropMenuCell class])]; 298 | } 299 | return _listTable; 300 | } 301 | -(UIView *)bottomIndicator 302 | { 303 | if (!_bottomIndicator) { 304 | _bottomIndicator = [UIView new]; 305 | _bottomIndicator.backgroundColor = self.jrOption.indicatorColor; 306 | _bottomIndicator.hidden = YES; 307 | _bottomIndicator.frame = CGRectMake(0, titleHeight - 2, titleWidth - 20, 1); 308 | } 309 | return _bottomIndicator; 310 | } 311 | -(UIView *)bottomSeparatLine 312 | { 313 | if (!_bottomSeparatLine) { 314 | _bottomSeparatLine = [UIView new]; 315 | _bottomSeparatLine.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1]; 316 | _bottomSeparatLine.frame = CGRectMake(0, titleHeight - 1, self.frame.size.width, 1); 317 | } 318 | return _bottomSeparatLine; 319 | } 320 | -(UIView *)maskBgView 321 | { 322 | if (!_maskBgView) { 323 | _maskBgView = [UIView new]; 324 | _maskBgView.backgroundColor = self.jrOption.maskColor; 325 | _maskBgView.frame = CGRectMake(0, CGRectGetMaxY(self.frame), [UIScreen mainScreen].bounds.size.width,[UIScreen mainScreen].bounds.size.height - CGRectGetMaxY(self.frame)); 326 | _maskBgView.hidden = YES; 327 | UITapGestureRecognizer * tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapMask:)]; 328 | [_maskBgView addGestureRecognizer:tapGR]; 329 | } 330 | return _maskBgView; 331 | } 332 | - (void)tapMask:(UITapGestureRecognizer *)tapGR 333 | { 334 | [self dismissWithAnimation:YES]; 335 | } 336 | /* 337 | // Only override drawRect: if you perform custom drawing. 338 | // An empty implementation adversely affects performance during animation. 339 | - (void)drawRect:(CGRect)rect { 340 | // Drawing code 341 | } 342 | */ 343 | 344 | @end 345 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropTitleItemView.h: -------------------------------------------------------------------------------- 1 | // 2 | // JRDropTitleItemView.h 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JROption.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | @class JRDropTitleItemView; 14 | 15 | @protocol JRDropTitleItemViewDelegate 16 | 17 | - (void)didClickTitleInJRDropTitleItemView:(JRDropTitleItemView *)itemView; 18 | 19 | @end 20 | 21 | @interface JRDropTitleItemView : UIView 22 | 23 | @property (nonatomic , strong) UILabel * titleLabel; 24 | @property (nonatomic , strong) UIImageView * arrowImg; 25 | 26 | @property (nonatomic , strong) JRTitle * title; 27 | 28 | @property (nonatomic , assign) BOOL isSelected; 29 | 30 | @property (nonatomic , weak) iddelegate; 31 | 32 | - (void)setText:(NSString *)text; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRDropTitleItemView.m: -------------------------------------------------------------------------------- 1 | // 2 | // JRDropTitleItemView.m 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import "JRDropTitleItemView.h" 10 | 11 | @implementation JRDropTitleItemView 12 | 13 | - (instancetype)initWithFrame:(CGRect)frame 14 | { 15 | self = [super initWithFrame:frame]; 16 | if (self) { 17 | _isSelected = NO; 18 | [self setupUI]; 19 | } 20 | return self; 21 | } 22 | 23 | - (void)setupUI 24 | { 25 | [self addSubview:self.titleLabel]; 26 | [self addSubview:self.arrowImg]; 27 | // [self layoutSubviews]; 28 | } 29 | -(void)setText:(NSString *)text 30 | { 31 | if (_title.changeTitleStyle == ChangeTitleStyleNever) { 32 | _titleLabel.text = [NSString stringWithFormat:@"%@%@",self.title.preTitleStr,_title.titleName]; 33 | }else{ 34 | _titleLabel.text = [NSString stringWithFormat:@"%@%@",self.title.preTitleStr,text]; 35 | } 36 | [_titleLabel sizeToFit]; 37 | switch (_title.titleAlignment) { 38 | case TitleAlignmentCenter: 39 | _titleLabel.center = CGPointMake(CGRectGetMidX(self.frame) - self.frame.origin.x, CGRectGetMidY(self.frame)); 40 | break; 41 | case TitleAlignmentLeft: 42 | _titleLabel.center = CGPointMake(_title.titleGap + _titleLabel.frame.size.width/2, CGRectGetMidY(self.frame)); 43 | break; 44 | case TitleAlignmentRight: 45 | _titleLabel.center = CGPointMake(CGRectGetMaxX(self.frame) - _titleLabel.frame.size.width/2 - _title.titleGap, CGRectGetMidY(self.frame)); 46 | break; 47 | 48 | default: 49 | break; 50 | } 51 | 52 | 53 | _arrowImg.frame = CGRectMake(CGRectGetMaxX(_titleLabel.frame) + 5, CGRectGetMidY(self.frame) - 3, 8, 6); 54 | [self layoutIfNeeded]; 55 | } 56 | -(void)setTitle:(JRTitle *)title 57 | { 58 | _title = title; 59 | 60 | _titleLabel.font = title.titleNormalFont; 61 | _titleLabel.textColor = title.titleNormalTintColor; 62 | _arrowImg.tintColor = title.titleNormalTintColor; 63 | self.backgroundColor = title.titleNormalBgColor; 64 | } 65 | -(void)setIsSelected:(BOOL)isSelected 66 | { 67 | _isSelected = isSelected; 68 | 69 | if (_isSelected) { 70 | _titleLabel.textColor = self.title.titleSelectedTintColor; 71 | _arrowImg.image = [self.title.titleSelectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; 72 | _arrowImg.tintColor = self.title.titleSelectedTintColor; 73 | }else{ 74 | _titleLabel.textColor = self.title.titleNormalTintColor; 75 | _arrowImg.image = [self.title.titleNormalImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; 76 | _arrowImg.tintColor = self.title.titleNormalTintColor; 77 | } 78 | } 79 | -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 80 | { 81 | if (_delegate && [_delegate respondsToSelector:@selector(didClickTitleInJRDropTitleItemView:)]) { 82 | self.isSelected = !self.isSelected; 83 | [_delegate didClickTitleInJRDropTitleItemView:self]; 84 | } 85 | } 86 | #pragma mark - lazy 87 | -(UILabel *)titleLabel 88 | { 89 | if (!_titleLabel) { 90 | _titleLabel = [UILabel new]; 91 | _titleLabel.textColor = [UIColor whiteColor]; 92 | _titleLabel.textAlignment = NSTextAlignmentCenter; 93 | } 94 | return _titleLabel; 95 | } 96 | -(UIImageView *)arrowImg 97 | { 98 | if (!_arrowImg) { 99 | _arrowImg = [UIImageView new]; 100 | _arrowImg.image = [UIImage imageNamed:@"down_arrow"]; 101 | } 102 | return _arrowImg; 103 | } 104 | /* 105 | // Only override drawRect: if you perform custom drawing. 106 | // An empty implementation adversely affects performance during animation. 107 | - (void)drawRect:(CGRect)rect { 108 | // Drawing code 109 | } 110 | */ 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRGlobalMacro.h: -------------------------------------------------------------------------------- 1 | // 2 | // JRGlobalMacro.h 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/12. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #ifndef JRGlobalMacro_h 10 | #define JRGlobalMacro_h 11 | 12 | #define AAObject(objectName) [[objectName alloc]init] 13 | 14 | 15 | #define JRPropStatementAndPropSetFuncStatement(propertyModifier,className, propertyPointerType, propertyName) \ 16 | @property(nonatomic,propertyModifier)propertyPointerType propertyName; \ 17 | - (className * (^) (propertyPointerType propertyName)) propertyName##Set; 18 | 19 | 20 | 21 | #define JRPropSetFuncImplementation(className, propertyPointerType, propertyName) \ 22 | - (className * (^) (propertyPointerType propertyName))propertyName##Set{ \ 23 | return ^(propertyPointerType propertyName) { \ 24 | self.propertyName = propertyName; \ 25 | return self; \ 26 | }; \ 27 | } 28 | 29 | #endif /* JRGlobalMacro_h */ 30 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRList.h: -------------------------------------------------------------------------------- 1 | // 2 | // JRList.h 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/12. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JRGlobalMacro.h" 11 | #import 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @interface JRList : NSObject 16 | 17 | /// 选中颜色 18 | JRPropStatementAndPropSetFuncStatement(strong, JRList, UIColor *, listSelectedTintColor); 19 | /// 未选中颜色 20 | JRPropStatementAndPropSetFuncStatement(strong, JRList, UIColor *, listNormalTintColor); 21 | /// 选中图片 22 | JRPropStatementAndPropSetFuncStatement(strong, JRList, UIImage *, listSelectedImage); 23 | /// 选中背景色 24 | JRPropStatementAndPropSetFuncStatement(strong, JRList, UIColor *, listSelectedBgColor); 25 | /// 未选中背景色 26 | JRPropStatementAndPropSetFuncStatement(strong, JRList, UIColor *, listNormalBgColor); 27 | /// 列表cell高度 28 | JRPropStatementAndPropSetFuncStatement(assign, JRList, CGFloat , listRowHeight); 29 | /// 列表内容数组 30 | JRPropStatementAndPropSetFuncStatement(copy , JRList, NSArray *, listArr); 31 | /// 显示原标题数组(Title ChangeTitleStyle为ChangeTitleStyleCustom时有效) 32 | JRPropStatementAndPropSetFuncStatement(copy , JRList, NSArray *, showOriginTitleIndexArr); 33 | 34 | 35 | @end 36 | 37 | NS_ASSUME_NONNULL_END 38 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRList.m: -------------------------------------------------------------------------------- 1 | // 2 | // JRList.m 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/12. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import "JRList.h" 10 | 11 | @implementation JRList 12 | 13 | -(instancetype)init 14 | { 15 | self = [super init]; 16 | if (self) { 17 | _listNormalTintColor = [UIColor blackColor]; 18 | _listSelectedTintColor = [UIColor systemBlueColor]; 19 | _listSelectedImage = [UIImage imageNamed:@"checkMark"]; 20 | _listSelectedBgColor = [UIColor whiteColor]; 21 | _listNormalBgColor = [UIColor whiteColor]; 22 | _listRowHeight = 40; 23 | _listArr = @[@[@"需配置列表内容数组"]]; 24 | _showOriginTitleIndexArr = [NSArray array]; 25 | } 26 | return self; 27 | } 28 | 29 | JRPropSetFuncImplementation(JRList, UIColor *, listSelectedTintColor); 30 | JRPropSetFuncImplementation(JRList, UIColor *, listNormalTintColor); 31 | JRPropSetFuncImplementation(JRList, UIImage *, listSelectedImage); 32 | JRPropSetFuncImplementation(JRList, UIColor *, listSelectedBgColor); 33 | JRPropSetFuncImplementation(JRList, UIColor *, listNormalBgColor); 34 | JRPropSetFuncImplementation(JRList, CGFloat , listRowHeight); 35 | JRPropSetFuncImplementation(JRList, NSArray *, listArr); 36 | JRPropSetFuncImplementation(JRList, NSArray *, showOriginTitleIndexArr); 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JROption.h: -------------------------------------------------------------------------------- 1 | // 2 | // JROption.h 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/12. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "JRGlobalMacro.h" 12 | #import "JRCategory.h" 13 | #import "JRTitle.h" 14 | #import "JRList.h" 15 | 16 | NS_ASSUME_NONNULL_BEGIN 17 | 18 | @interface JROption : NSObject 19 | 20 | /// 标题配置 21 | JRPropStatementAndPropSetFuncStatement(copy, JROption, NSArray *, categoryArr); 22 | /// 是否显示BottomIndicator 23 | JRPropStatementAndPropSetFuncStatement(assign, JROption, BOOL , showIndicator); 24 | JRPropStatementAndPropSetFuncStatement(strong, JROption, UIColor *, indicatorColor); 25 | /// 设置圆角 26 | JRPropStatementAndPropSetFuncStatement(assign, JROption, CGFloat , indicatorHeight); 27 | /// 是否显示BottomSeparatLine 28 | JRPropStatementAndPropSetFuncStatement(assign, JROption, BOOL , showBottomLine); 29 | /// 遮罩颜色 30 | JRPropStatementAndPropSetFuncStatement(strong, JROption, UIColor *, maskColor); 31 | /// 设置圆角 32 | JRPropStatementAndPropSetFuncStatement(assign, JROption, CGFloat , cornerRadius); 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JROption.m: -------------------------------------------------------------------------------- 1 | // 2 | // JROption.m 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/12. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import "JROption.h" 10 | 11 | @implementation JROption 12 | 13 | -(instancetype)init 14 | { 15 | self = [super init]; 16 | if (self) { 17 | _categoryArr = @[JRCategory.new]; 18 | _showIndicator = YES; 19 | _indicatorHeight = 1; 20 | _indicatorColor = [UIColor systemBlueColor]; 21 | _showBottomLine = YES; 22 | _maskColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.6]; 23 | } 24 | return self; 25 | } 26 | 27 | JRPropSetFuncImplementation(JROption, NSArray *, categoryArr); 28 | JRPropSetFuncImplementation(JROption, BOOL , showIndicator); 29 | JRPropSetFuncImplementation(JROption, UIColor *, indicatorColor); 30 | JRPropSetFuncImplementation(JROption, CGFloat , indicatorHeight); 31 | JRPropSetFuncImplementation(JROption, BOOL , showBottomLine); 32 | JRPropSetFuncImplementation(JROption, UIColor *, maskColor); 33 | JRPropSetFuncImplementation(JROption, CGFloat , cornerRadius); 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRTitle.h: -------------------------------------------------------------------------------- 1 | // 2 | // JRTitle.h 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/12. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "JRGlobalMacro.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | typedef NS_ENUM(NSUInteger, ChangeTitleStyle) { 16 | ChangeTitleStyleAlways, //替换标题为选项 17 | ChangeTitleStyleNever, //不替换标题为选项 18 | ChangeTitleStyleCustom, //自定义选项是否需要替换标题 19 | }; 20 | typedef NS_ENUM(NSUInteger, TitleAlignment) { 21 | TitleAlignmentCenter, //居中对齐 22 | TitleAlignmentLeft, //居左对齐 23 | TitleAlignmentRight, //居右对齐 24 | }; 25 | 26 | @interface JRTitle : NSObject 27 | 28 | /// 选中颜色 29 | JRPropStatementAndPropSetFuncStatement(strong, JRTitle, UIColor *, titleSelectedTintColor); 30 | 31 | /// 未选中颜色 32 | JRPropStatementAndPropSetFuncStatement(strong, JRTitle, UIColor *, titleNormalTintColor); 33 | 34 | /// 未选中字体 35 | JRPropStatementAndPropSetFuncStatement(strong, JRTitle, UIFont * , titleNormalFont); 36 | 37 | /// 选中字体 38 | JRPropStatementAndPropSetFuncStatement(strong, JRTitle, UIFont * , titleSelectedFont); 39 | 40 | /// 未选中背景色 41 | JRPropStatementAndPropSetFuncStatement(strong, JRTitle, UIColor *, titleNormalBgColor); 42 | 43 | /// 选中背景色 44 | JRPropStatementAndPropSetFuncStatement(strong, JRTitle, UIColor *, titleSelectedBgColor); 45 | 46 | /// 选中图标 47 | JRPropStatementAndPropSetFuncStatement(strong, JRTitle, UIImage *, titleSelectedImage); 48 | 49 | /// 未选中图标 50 | JRPropStatementAndPropSetFuncStatement(strong, JRTitle, UIImage *, titleNormalImage); 51 | 52 | /// 标题内容 53 | JRPropStatementAndPropSetFuncStatement(copy, JRTitle, NSString *, titleName); 54 | 55 | /// 是否根据选项修改标题 56 | JRPropStatementAndPropSetFuncStatement(assign, JRTitle, ChangeTitleStyle , changeTitleStyle); 57 | 58 | /// 标题前缀 59 | JRPropStatementAndPropSetFuncStatement(copy, JRTitle, NSString * , preTitleStr); 60 | 61 | /// 默认选中 62 | JRPropStatementAndPropSetFuncStatement(assign , JRTitle, NSInteger , defaultIndex); 63 | 64 | /// 对齐方式 65 | JRPropStatementAndPropSetFuncStatement(assign , JRTitle, TitleAlignment , titleAlignment); 66 | 67 | /// 对齐边距,仅在对齐方式不为TitleAlignmentCenter时生效 68 | JRPropStatementAndPropSetFuncStatement(assign , JRTitle, NSInteger , titleGap); 69 | 70 | @end 71 | 72 | NS_ASSUME_NONNULL_END 73 | -------------------------------------------------------------------------------- /JRDropMenuDemo/JRDropMenu/JRTitle.m: -------------------------------------------------------------------------------- 1 | // 2 | // JRTitle.m 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/12. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import "JRTitle.h" 10 | 11 | @implementation JRTitle 12 | 13 | -(instancetype)init 14 | { 15 | self = [super init]; 16 | if (self) { 17 | _titleSelectedTintColor = [UIColor systemBlueColor]; 18 | _titleNormalTintColor = [UIColor blackColor]; 19 | _titleNormalFont = [UIFont systemFontOfSize:12]; 20 | _titleSelectedFont = [UIFont systemFontOfSize:12]; 21 | _titleNormalBgColor = [UIColor whiteColor]; 22 | _titleSelectedBgColor = [UIColor whiteColor]; 23 | _titleNormalImage = [UIImage imageNamed:@"down_arrow"]; 24 | _titleSelectedImage = [UIImage imageNamed:@"up_arrow"]; 25 | _titleName = @"需配置标题"; 26 | _changeTitleStyle = ChangeTitleStyleAlways; 27 | _preTitleStr = @""; 28 | _defaultIndex = 0; 29 | _titleAlignment = TitleAlignmentCenter; 30 | _titleGap = 5; 31 | } 32 | return self; 33 | } 34 | 35 | JRPropSetFuncImplementation(JRTitle, UIColor *, titleSelectedTintColor); 36 | JRPropSetFuncImplementation(JRTitle, UIColor *, titleNormalTintColor); 37 | JRPropSetFuncImplementation(JRTitle, UIFont *, titleNormalFont); 38 | JRPropSetFuncImplementation(JRTitle, UIFont *, titleSelectedFont); 39 | JRPropSetFuncImplementation(JRTitle, UIColor *, titleNormalBgColor); 40 | JRPropSetFuncImplementation(JRTitle, UIColor *, titleSelectedBgColor); 41 | JRPropSetFuncImplementation(JRTitle, UIImage *, titleSelectedImage); 42 | JRPropSetFuncImplementation(JRTitle, UIImage *, titleNormalImage); 43 | JRPropSetFuncImplementation(JRTitle, NSString *, titleName); 44 | JRPropSetFuncImplementation(JRTitle, ChangeTitleStyle , changeTitleStyle); 45 | JRPropSetFuncImplementation(JRTitle, NSString *, preTitleStr); 46 | JRPropSetFuncImplementation(JRTitle, NSInteger , defaultIndex); 47 | JRPropSetFuncImplementation(JRTitle, TitleAlignment , titleAlignment); 48 | JRPropSetFuncImplementation(JRTitle, NSInteger , titleGap); 49 | 50 | 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /JRDropMenuDemo/SceneDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.h 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SceneDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow * window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /JRDropMenuDemo/SceneDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.m 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import "SceneDelegate.h" 10 | 11 | @interface SceneDelegate () 12 | 13 | @end 14 | 15 | @implementation SceneDelegate 16 | 17 | 18 | - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { 19 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 20 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 21 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 22 | } 23 | 24 | 25 | - (void)sceneDidDisconnect:(UIScene *)scene { 26 | // Called as the scene is being released by the system. 27 | // This occurs shortly after the scene enters the background, or when its session is discarded. 28 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 29 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 30 | } 31 | 32 | 33 | - (void)sceneDidBecomeActive:(UIScene *)scene { 34 | // Called when the scene has moved from an inactive state to an active state. 35 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 36 | } 37 | 38 | 39 | - (void)sceneWillResignActive:(UIScene *)scene { 40 | // Called when the scene will move from an active state to an inactive state. 41 | // This may occur due to temporary interruptions (ex. an incoming phone call). 42 | } 43 | 44 | 45 | - (void)sceneWillEnterForeground:(UIScene *)scene { 46 | // Called as the scene transitions from the background to the foreground. 47 | // Use this method to undo the changes made on entering the background. 48 | } 49 | 50 | 51 | - (void)sceneDidEnterBackground:(UIScene *)scene { 52 | // Called as the scene transitions from the foreground to the background. 53 | // Use this method to save data, release shared resources, and store enough scene-specific state information 54 | // to restore the scene back to its current state. 55 | } 56 | 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /JRDropMenuDemo/SecondViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.h 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/14. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JRDropMenuView.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | typedef NS_ENUM(NSUInteger, JRDropMenuType) { 15 | JRDropMenuTypePre, 16 | JRDropMenuTypeDefault, 17 | JRDropMenuTypeMultiple, 18 | JRDropMenuTypeTitleCustom, 19 | JRDropMenuTypeListCustom, 20 | JRDropMenuTypeListShowOrigin 21 | }; 22 | 23 | @interface SecondViewController : UIViewController 24 | 25 | @property (nonatomic , assign) JRDropMenuType menuType; 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /JRDropMenuDemo/SecondViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.m 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/14. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import "SecondViewController.h" 10 | 11 | @interface SecondViewController () 12 | 13 | @property (nonatomic , strong) JRDropMenuView * menuView; 14 | 15 | @end 16 | 17 | @implementation SecondViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view. 22 | 23 | 24 | self.menuView = [[JRDropMenuView alloc] initWithFrame:CGRectMake(00, 88, [UIScreen mainScreen].bounds.size.width, 44)]; 25 | self.menuView.delegate = self; 26 | 27 | [self.view addSubview:self.menuView]; 28 | 29 | [self setupMenuWithJRDromMenuType:self.menuType]; 30 | } 31 | - (void)setupMenuWithJRDromMenuType:(JRDropMenuType)type 32 | { 33 | switch (type) { 34 | case JRDropMenuTypePre://有前缀 35 | [self.menuView createJRDropMenuViewWithOption:[self option1]]; 36 | break; 37 | case JRDropMenuTypeDefault://有默认选中项 38 | [self.menuView createJRDropMenuViewWithOption:[self option2]]; 39 | break; 40 | case JRDropMenuTypeMultiple://多列 41 | [self.menuView createJRDropMenuViewWithOption:[self option3]]; 42 | break; 43 | case JRDropMenuTypeTitleCustom://自定义标题样式 44 | [self.menuView createJRDropMenuViewWithOption:[self option4]]; 45 | break; 46 | case JRDropMenuTypeListCustom://自定义列表样式 47 | [self.menuView createJRDropMenuViewWithOption:[self option5]]; 48 | break; 49 | case JRDropMenuTypeListShowOrigin://设置选中不替换标题Index 50 | [self.menuView createJRDropMenuViewWithOption:[self option6]]; 51 | break; 52 | 53 | default: 54 | break; 55 | } 56 | 57 | } 58 | - (JROption *)option1 59 | { 60 | JROption * option = JROption.new 61 | .categoryArrSet(@[ 62 | JRCategory.new 63 | .titleSet(JRTitle.new 64 | .titleNameSet(@"Lan") 65 | .preTitleStrSet(@"Language : ") 66 | ) 67 | .listSet(JRList.new 68 | .listArrSet(@[@"ALL",@"PHP",@"OC",@"Swift",@"Java",@"JavaScript"]) 69 | ) 70 | ] 71 | ); 72 | return option; 73 | } 74 | - (JROption *)option2 75 | { 76 | JROption * option = JROption.new 77 | .categoryArrSet(@[ 78 | JRCategory.new 79 | .titleSet(JRTitle.new 80 | .titleNameSet(@"Lan") 81 | .preTitleStrSet(@"Language : ") 82 | .defaultIndexSet(2) 83 | ) 84 | .listSet(JRList.new 85 | .listArrSet(@[@"ALL",@"PHP",@"OC",@"Swift",@"Java",@"JavaScript"]) 86 | ) 87 | ] 88 | ); 89 | return option; 90 | } 91 | - (JROption *)option3 92 | { 93 | JROption * option = JROption.new 94 | .categoryArrSet(@[ 95 | JRCategory.new 96 | .titleSet(JRTitle.new 97 | .titleNameSet(@"Language") 98 | ) 99 | .listSet(JRList.new 100 | .listArrSet(@[@"ALL",@"PHP",@"OC",@"Swift",@"Java",@"JavaScript"]) 101 | ) 102 | , 103 | 104 | JRCategory.new 105 | .titleSet(JRTitle.new 106 | .titleNameSet(@"Month") 107 | ) 108 | .listSet(JRList.new 109 | .listArrSet(@[@"ALL",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12"]) 110 | .listRowHeightSet(40) 111 | ) 112 | , 113 | 114 | JRCategory.new 115 | .titleSet(JRTitle.new 116 | .titleNameSet(@"Time") 117 | ) 118 | .listSet(JRList.new 119 | .listArrSet(@[@"ALL",@"Last 24h",@"Last 7day",@"Last 30day"]) 120 | .listRowHeightSet(40) 121 | ) 122 | ] 123 | ); 124 | return option; 125 | } 126 | - (JROption *)option4 127 | { 128 | JROption * option = JROption.new 129 | .categoryArrSet(@[ 130 | JRCategory.new 131 | .titleSet(JRTitle.new 132 | .titleNameSet(@"Language") 133 | .titleSelectedTintColorSet([UIColor blackColor]) 134 | .titleNormalTintColorSet([UIColor whiteColor]) 135 | .titleNormalFontSet([UIFont systemFontOfSize:12]) 136 | .titleNormalBgColorSet([UIColor colorWithRed:6/255.0 green:26/255.0 blue:52/255.0 alpha:.8]) 137 | .titleAlignmentSet(TitleAlignmentLeft) 138 | ) 139 | .listSet(JRList.new 140 | .listArrSet(@[@"ALL",@"PHP",@"OC",@"Swift",@"Java",@"JavaScript"]) 141 | 142 | ) 143 | ] 144 | ) 145 | .showIndicatorSet(NO); 146 | return option; 147 | } 148 | - (JROption *)option5 149 | { 150 | JROption * option = JROption.new 151 | .categoryArrSet(@[ 152 | JRCategory.new 153 | .titleSet(JRTitle.new 154 | .titleNameSet(@"Language") 155 | .changeTitleStyleSet(ChangeTitleStyleNever) 156 | ) 157 | .listSet(JRList.new 158 | .listArrSet(@[@"ALL",@"PHP",@"OC",@"Swift",@"Java",@"JavaScript"]) 159 | .listRowHeightSet(60) 160 | .listNormalBgColorSet([UIColor lightGrayColor]) 161 | .listNormalTintColorSet([UIColor redColor]) 162 | ) 163 | ] 164 | ) 165 | .showIndicatorSet(NO); 166 | return option; 167 | } 168 | - (JROption *)option6 169 | { 170 | JROption * option = JROption.new 171 | .categoryArrSet(@[ 172 | JRCategory.new 173 | .titleSet(JRTitle.new 174 | .titleNameSet(@"Language") 175 | .changeTitleStyleSet(ChangeTitleStyleCustom) 176 | ) 177 | .listSet(JRList.new 178 | .listArrSet(@[@"ALL(选中不替换标题)",@"PHP",@"OC(选中不替换标题)",@"Swift",@"Java",@"JavaScript"]) 179 | .listRowHeightSet(60) 180 | .listNormalBgColorSet([UIColor lightGrayColor]) 181 | .listNormalTintColorSet([UIColor redColor]) 182 | .showOriginTitleIndexArrSet(@[@0,@2]) 183 | ) 184 | ] 185 | ) 186 | .showIndicatorSet(NO); 187 | return option; 188 | } 189 | -(void)viewWillDisappear:(BOOL)animated 190 | { 191 | [super viewWillDisappear:animated]; 192 | 193 | [self.menuView dismissWithAnimation:NO]; 194 | } 195 | /* 196 | #pragma mark - Navigation 197 | 198 | // In a storyboard-based application, you will often want to do a little preparation before navigation 199 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 200 | // Get the new view controller using [segue destinationViewController]. 201 | // Pass the selected object to the new view controller. 202 | } 203 | */ 204 | 205 | @end 206 | -------------------------------------------------------------------------------- /JRDropMenuDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /JRDropMenuDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "JRDropMenuView.h" 11 | 12 | @interface ViewController () 13 | 14 | @property (nonatomic , strong) JRDropMenuView * menuView; 15 | 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view. 23 | self.view.backgroundColor = [UIColor whiteColor]; 24 | 25 | } 26 | -(void)viewDidAppear:(BOOL)animated 27 | { 28 | [super viewDidAppear:animated]; 29 | 30 | self.menuView = [[JRDropMenuView alloc] initWithFrame:CGRectMake(20, 80, [UIScreen mainScreen].bounds.size.width - 40, 44)]; 31 | self.menuView.delegate = self; 32 | [self.menuView createJRDropMenuViewWithOption:[self setupOption]]; 33 | [self.view addSubview:self.menuView]; 34 | } 35 | - (JROption *)setupOption 36 | { 37 | JROption * option = JROption.new 38 | .categoryArrSet(@[ 39 | JRCategory.new 40 | .titleSet(JRTitle.new 41 | .titleNameSet(@"Vsl") 42 | .titleSelectedTintColorSet([UIColor colorWithRed:64/255.0 green:158/255.0 blue:255/255.0 alpha:1]) 43 | .titleNormalTintColorSet([UIColor colorWithRed:82/255.0 green:102/255.0 blue:118/255.0 alpha:1]) 44 | .titleNormalFontSet([UIFont systemFontOfSize:11]) 45 | .defaultIndexSet(1) 46 | ) 47 | .listSet(JRList.new 48 | .listArrSet(@[@"ALL",@"Ocean Dalian"]) 49 | .showOriginTitleIndexArrSet(@[@0]) 50 | .listRowHeightSet(40) 51 | ) 52 | , 53 | 54 | JRCategory.new 55 | .titleSet(JRTitle.new 56 | .titleNameSet(@"Type") 57 | ) 58 | .listSet(JRList.new 59 | .listArrSet(@[@"ALL",@"Noon",@"EOSP",@"Berthing",@"Anchoring",@"Shifting",@"Cargo",@"Departure"]) 60 | .listRowHeightSet(40) 61 | ) 62 | , 63 | 64 | JRCategory.new 65 | .titleSet(JRTitle.new 66 | .titleNameSet(@"Time") 67 | ) 68 | .listSet(JRList.new 69 | .listArrSet(@[@"ALL",@"Last 24h",@"Last 7day",@"Last 30day"]) 70 | .listRowHeightSet(40) 71 | ) 72 | ] 73 | ) 74 | .showIndicatorSet(YES) 75 | .showBottomLineSet(YES); 76 | return option; 77 | 78 | // JROption * option = JROption.new 79 | // .categoryArrSet(@[ 80 | // JRCategory.new 81 | // .titleSet(JRTitle.new 82 | // .titleNameSet(@"Vsl") 83 | // .titleSelectedTintColorSet([UIColor blackColor]) 84 | // .titleNormalTintColorSet([UIColor whiteColor]) 85 | // .titleNormalFontSet([UIFont systemFontOfSize:12]) 86 | // .titleNormalBgColorSet([UIColor colorWithRed:6/255.0 green:26/255.0 blue:52/255.0 alpha:.8]) 87 | // .preTitleStrSet(@"Voyage : ") 88 | // ) 89 | // .listSet(JRList.new 90 | // .listArrSet(@[@"ALL",@"Ocean Dalian"]) 91 | // .listRowHeightSet(40) 92 | // .listNormalBgColorSet([UIColor whiteColor]) 93 | // .listNormalTintColorSet([UIColor lightGrayColor]) 94 | // ) 95 | // ] 96 | // ) 97 | // .showIndicatorSet(NO) 98 | // .showBottomLineSet(NO) 99 | // .maskColorSet([UIColor clearColor]) 100 | // .cornerRadiusSet(4); 101 | // return option; 102 | } 103 | #pragma mark - Delegate 104 | -(void)jrDropMenuView:(JRDropMenuView *)jrDropMenuView ResultArr:(nonnull NSMutableArray *)resultArr 105 | { 106 | 107 | } 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /JRDropMenuDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JRDropMenuDemo 4 | // 5 | // Created by 郭吉荣 on 2020/6/1. 6 | // Copyright © 2020 Imaritime. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | NSString * appDelegateClassName; 14 | @autoreleasepool { 15 | // Setup code that might create autoreleased objects goes here. 16 | appDelegateClassName = NSStringFromClass([AppDelegate class]); 17 | } 18 | return UIApplicationMain(argc, argv, nil, appDelegateClassName); 19 | } 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 andy123234 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 | # JRDropMenu 2 | 3 | [![](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/AAChartModel/AAChartKit/blob/master/LICENSE)
4 | [![](https://img.shields.io/badge/language-OC-green.svg)](https://github.com/AAChartModel/AAChartKit)
5 | 6 | ## 真机美图 7 | | 单列表 | 标题有前缀 | 默认选中项 | 8 | | :----: | :----: | :----: | 9 | | ![image1](https://github.com/andy123234/JRDropMenu/blob/master/ScreenShots/9.png) | ![image1](https://github.com/andy123234/JRDropMenu/blob/master/ScreenShots/8.png) | ![image1](https://github.com/andy123234/JRDropMenu/blob/master/ScreenShots/2.png) | 10 | 11 | | 自定义标题样式 | 自定义列表样式 | 选中不替换标题Index | 12 | | :----: | :----: | :----: | 13 | | ![image1](https://github.com/andy123234/JRDropMenu/blob/master/ScreenShots/1.png) | ![image1](https://github.com/andy123234/JRDropMenu/blob/master/ScreenShots/6.png) | ![image1](https://github.com/andy123234/JRDropMenu/blob/master/ScreenShots/10.png) | 14 | 15 | ## 使用前安装 16 | 17 | ### 手动安装 18 | 1. 将项目`Demo`中的文件夹`JRDropMenu`拖入到所需项目中. 19 | 2. 在你的项目的 `.pch` 全局宏定义文件中添加 20 | 21 | ```objective-c 22 | #import "JRDropMenuView.h" 23 | ``` 24 | 25 | ## 正式开始使用 26 | ### 1. 在你的`ViewController`视图控制器文件中添加 27 | ```objective-c 28 | #import "JRDropMenuView.h" 29 | ``` 30 | ### 2. 创建视图`JRDropMenuView` 31 | ```objective-c 32 | self.menuView = [[JRDropMenuView alloc] initWithFrame:CGRectMake(00, 88, [UIScreen mainScreen].bounds.size.width, 44)]; 33 | self.menuView.delegate = self; 34 | [self.menuView createJRDropMenuViewWithOption:[self option]]; 35 | [self.view addSubview:self.menuView]; 36 | ``` 37 | ### 3. JRCategory需包含JRTitle和JRList属性完成一列下拉菜单的配置 38 | > JRCategory -> JRTitle + JRList = JROption 39 | 40 | ``` 41 | - (JROption *)option 42 | { 43 | JROption * option = JROption.new 44 | .categoryArrSet(@[ 45 | JRCategory.new 46 | .titleSet(JRTitle.new 47 | .titleNameSet(@"标题名称") 48 | ) 49 | .listSet(JRList.new 50 | .listArrSet(列表数组) 51 | ) 52 | ] 53 | ); 54 | return option; 55 | } 56 | ``` 57 | ### 4. 自定义标题和列表属性 58 | > 根据JROption,JRTitle和JRList的头文件来选择需要自定义的属性,使用点语法即可轻松完成配置 59 | ``` 60 | JROption * option = JROption.new 61 | .categoryArrSet(@[ 62 | JRCategory.new 63 | .titleSet(JRTitle.new 64 | .titleNameSet(@"Language") 65 | .titleSelectedTintColorSet([UIColor blackColor]) 66 | .titleNormalTintColorSet([UIColor whiteColor]) 67 | .titleNormalFontSet([UIFont systemFontOfSize:12]) 68 | .titleNormalBgColorSet([UIColor colorWithRed:6/255.0 green:26/255.0 blue:52/255.0 alpha:.8]) 69 | ) 70 | .listSet(JRList.new 71 | .listArrSet(@[@"ALL",@"PHP",@"OC",@"Swift",@"Java",@"JavaScript"]) 72 | .listRowHeightSet(60) 73 | .listNormalBgColorSet([UIColor lightGrayColor]) 74 | .listNormalTintColorSet([UIColor redColor]) 75 | ) 76 | ] 77 | ) 78 | .showIndicatorSet(NO); 79 | return option; 80 | ``` 81 | ### 5. 移除视图 82 | > 在即将离开视图时需调用dissmiss方法,并关闭动画 83 | ``` 84 | -(void)viewWillDisappear:(BOOL)animated 85 | { 86 | [super viewWillDisappear:animated]; 87 | 88 | [self.menuView dismissWithAnimation:NO]; 89 | } 90 | ``` 91 | ## 特别说明 92 | 93 | ### 获取点击事件结果 94 | 95 | > 可通过给 JRDropMenuView 示例对象设置代理方法,来实现监听用户的点击事件 96 | 97 | ``` 98 | - (void)jrDropMenuView:(JRDropMenuView *)jrDropMenuView ResultArr:(NSMutableArray *)resultArr; 99 | ``` 100 | -------------------------------------------------------------------------------- /ScreenShots/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/ScreenShots/1.png -------------------------------------------------------------------------------- /ScreenShots/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/ScreenShots/10.png -------------------------------------------------------------------------------- /ScreenShots/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/ScreenShots/2.png -------------------------------------------------------------------------------- /ScreenShots/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/ScreenShots/3.png -------------------------------------------------------------------------------- /ScreenShots/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/ScreenShots/4.png -------------------------------------------------------------------------------- /ScreenShots/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/ScreenShots/5.png -------------------------------------------------------------------------------- /ScreenShots/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/ScreenShots/6.png -------------------------------------------------------------------------------- /ScreenShots/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/ScreenShots/7.png -------------------------------------------------------------------------------- /ScreenShots/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/ScreenShots/8.png -------------------------------------------------------------------------------- /ScreenShots/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andy123234/JRDropMenu/0493b25cfa5a82ffe9e4bdf724026050f839950e/ScreenShots/9.png --------------------------------------------------------------------------------