├── .gitignore ├── JMColumnMenu.podspec ├── JMColumnMenu.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── JMColumnMenu ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── JMColumnMenu │ ├── JMColumnMenu.bundle │ │ ├── add.png │ │ ├── close.png │ │ └── close_one.png │ ├── JMColumnMenu.h │ ├── JMColumnMenu.m │ ├── JMColumnMenuCell.h │ ├── JMColumnMenuCell.m │ ├── JMColumnMenuFooterView.h │ ├── JMColumnMenuFooterView.m │ ├── JMColumnMenuHeaderView.h │ ├── JMColumnMenuHeaderView.m │ ├── JMColumnMenuModel.h │ ├── JMColumnMenuModel.m │ ├── JMConfig.h │ ├── JMConfig.m │ ├── UIView+JM.h │ └── UIView+JM.m ├── ViewController.h ├── ViewController.m └── main.m ├── JMColumnMenuTests ├── Info.plist └── JMColumnMenuTests.m ├── JMColumnMenuUITests ├── Info.plist └── JMColumnMenuUITests.m ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /JMColumnMenu.podspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pod::Spec.new do |s| 4 | 5 | s.name = "JMColumnMenu" 6 | s.version = "1.1.1" 7 | s.summary = "对腾讯新闻、今日头条等栏目管理的封装, 一行代码调用" 8 | 9 | s.description = <<-DESC 10 | 对腾讯新闻、今日头条等栏目管理的封装, 一行代码调用 11 | DESC 12 | 13 | s.homepage = "https://github.com/JunAILiang/JMColumnMenu" 14 | 15 | s.license = "MIT" 16 | 17 | s.author = { "LJM" => "gzliujm@163.com" } 18 | 19 | s.platform = :ios, "8.0" 20 | 21 | s.source = { :git => "https://github.com/JunAILiang/JMColumnMenu.git", :tag => "#{s.version}" } 22 | 23 | s.source_files = "JMColumnMenu/JMColumnMenu/**/*.{h,m}" 24 | 25 | s.resource = 'JMColumnMenu/JMColumnMenu/JMColumnMenu.bundle' 26 | 27 | s.requires_arc = true 28 | 29 | end 30 | -------------------------------------------------------------------------------- /JMColumnMenu.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | CB0FCF6D1FDFA0310075C50B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CB0FCF6C1FDFA0310075C50B /* AppDelegate.m */; }; 11 | CB0FCF701FDFA0310075C50B /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CB0FCF6F1FDFA0310075C50B /* ViewController.m */; }; 12 | CB0FCF731FDFA0310075C50B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CB0FCF711FDFA0310075C50B /* Main.storyboard */; }; 13 | CB0FCF751FDFA0310075C50B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CB0FCF741FDFA0310075C50B /* Assets.xcassets */; }; 14 | CB0FCF781FDFA0310075C50B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CB0FCF761FDFA0310075C50B /* LaunchScreen.storyboard */; }; 15 | CB0FCF7B1FDFA0310075C50B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CB0FCF7A1FDFA0310075C50B /* main.m */; }; 16 | CB0FCF851FDFA0310075C50B /* JMColumnMenuTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CB0FCF841FDFA0310075C50B /* JMColumnMenuTests.m */; }; 17 | CB0FCF901FDFA0310075C50B /* JMColumnMenuUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = CB0FCF8F1FDFA0310075C50B /* JMColumnMenuUITests.m */; }; 18 | CB0FCFAB1FDFA0B40075C50B /* JMColumnMenuModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CB0FCF9E1FDFA0B30075C50B /* JMColumnMenuModel.m */; }; 19 | CB0FCFAC1FDFA0B40075C50B /* JMColumnMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = CB0FCF9F1FDFA0B30075C50B /* JMColumnMenu.m */; }; 20 | CB0FCFAD1FDFA0B40075C50B /* UIView+JM.m in Sources */ = {isa = PBXBuildFile; fileRef = CB0FCFA01FDFA0B30075C50B /* UIView+JM.m */; }; 21 | CB0FCFAE1FDFA0B40075C50B /* JMConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = CB0FCFA11FDFA0B30075C50B /* JMConfig.m */; }; 22 | CB0FCFAF1FDFA0B40075C50B /* JMColumnMenuCell.m in Sources */ = {isa = PBXBuildFile; fileRef = CB0FCFA81FDFA0B30075C50B /* JMColumnMenuCell.m */; }; 23 | CB0FCFB11FDFA0B40075C50B /* JMColumnMenuHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = CB0FCFAA1FDFA0B30075C50B /* JMColumnMenuHeaderView.m */; }; 24 | CB6FF4FE1FE0EE6600BA9A39 /* JMColumnMenu.bundle in Resources */ = {isa = PBXBuildFile; fileRef = CB6FF4FD1FE0EE6600BA9A39 /* JMColumnMenu.bundle */; }; 25 | CBAA51991FE7828E007BFEEE /* JMColumnMenuFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = CBAA51981FE7828E007BFEEE /* JMColumnMenuFooterView.m */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | CB0FCF811FDFA0310075C50B /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = CB0FCF601FDFA0310075C50B /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = CB0FCF671FDFA0310075C50B; 34 | remoteInfo = JMColumnMenu; 35 | }; 36 | CB0FCF8C1FDFA0310075C50B /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = CB0FCF601FDFA0310075C50B /* Project object */; 39 | proxyType = 1; 40 | remoteGlobalIDString = CB0FCF671FDFA0310075C50B; 41 | remoteInfo = JMColumnMenu; 42 | }; 43 | /* End PBXContainerItemProxy section */ 44 | 45 | /* Begin PBXFileReference section */ 46 | CB0FCF681FDFA0310075C50B /* JMColumnMenu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JMColumnMenu.app; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | CB0FCF6B1FDFA0310075C50B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | CB0FCF6C1FDFA0310075C50B /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | CB0FCF6E1FDFA0310075C50B /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 50 | CB0FCF6F1FDFA0310075C50B /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 51 | CB0FCF721FDFA0310075C50B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 52 | CB0FCF741FDFA0310075C50B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 53 | CB0FCF771FDFA0310075C50B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 54 | CB0FCF791FDFA0310075C50B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | CB0FCF7A1FDFA0310075C50B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 56 | CB0FCF801FDFA0310075C50B /* JMColumnMenuTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JMColumnMenuTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | CB0FCF841FDFA0310075C50B /* JMColumnMenuTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JMColumnMenuTests.m; sourceTree = ""; }; 58 | CB0FCF861FDFA0310075C50B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 59 | CB0FCF8B1FDFA0310075C50B /* JMColumnMenuUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JMColumnMenuUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | CB0FCF8F1FDFA0310075C50B /* JMColumnMenuUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JMColumnMenuUITests.m; sourceTree = ""; }; 61 | CB0FCF911FDFA0310075C50B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 62 | CB0FCF9E1FDFA0B30075C50B /* JMColumnMenuModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMColumnMenuModel.m; sourceTree = ""; }; 63 | CB0FCF9F1FDFA0B30075C50B /* JMColumnMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMColumnMenu.m; sourceTree = ""; }; 64 | CB0FCFA01FDFA0B30075C50B /* UIView+JM.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+JM.m"; sourceTree = ""; }; 65 | CB0FCFA11FDFA0B30075C50B /* JMConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMConfig.m; sourceTree = ""; }; 66 | CB0FCFA21FDFA0B30075C50B /* JMColumnMenuCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMColumnMenuCell.h; sourceTree = ""; }; 67 | CB0FCFA31FDFA0B30075C50B /* JMColumnMenuHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMColumnMenuHeaderView.h; sourceTree = ""; }; 68 | CB0FCFA51FDFA0B30075C50B /* JMColumnMenuModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMColumnMenuModel.h; sourceTree = ""; }; 69 | CB0FCFA61FDFA0B30075C50B /* JMConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMConfig.h; sourceTree = ""; }; 70 | CB0FCFA71FDFA0B30075C50B /* UIView+JM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+JM.h"; sourceTree = ""; }; 71 | CB0FCFA81FDFA0B30075C50B /* JMColumnMenuCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMColumnMenuCell.m; sourceTree = ""; }; 72 | CB0FCFAA1FDFA0B30075C50B /* JMColumnMenuHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMColumnMenuHeaderView.m; sourceTree = ""; }; 73 | CB6FF4FD1FE0EE6600BA9A39 /* JMColumnMenu.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = JMColumnMenu.bundle; sourceTree = ""; }; 74 | CB6FF4FF1FE0EEA500BA9A39 /* JMColumnMenu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JMColumnMenu.h; sourceTree = ""; }; 75 | CBAA51971FE7828E007BFEEE /* JMColumnMenuFooterView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JMColumnMenuFooterView.h; sourceTree = ""; }; 76 | CBAA51981FE7828E007BFEEE /* JMColumnMenuFooterView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JMColumnMenuFooterView.m; sourceTree = ""; }; 77 | /* End PBXFileReference section */ 78 | 79 | /* Begin PBXFrameworksBuildPhase section */ 80 | CB0FCF651FDFA0310075C50B /* Frameworks */ = { 81 | isa = PBXFrameworksBuildPhase; 82 | buildActionMask = 2147483647; 83 | files = ( 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | CB0FCF7D1FDFA0310075C50B /* Frameworks */ = { 88 | isa = PBXFrameworksBuildPhase; 89 | buildActionMask = 2147483647; 90 | files = ( 91 | ); 92 | runOnlyForDeploymentPostprocessing = 0; 93 | }; 94 | CB0FCF881FDFA0310075C50B /* Frameworks */ = { 95 | isa = PBXFrameworksBuildPhase; 96 | buildActionMask = 2147483647; 97 | files = ( 98 | ); 99 | runOnlyForDeploymentPostprocessing = 0; 100 | }; 101 | /* End PBXFrameworksBuildPhase section */ 102 | 103 | /* Begin PBXGroup section */ 104 | CB0FCF5F1FDFA0310075C50B = { 105 | isa = PBXGroup; 106 | children = ( 107 | CB0FCF6A1FDFA0310075C50B /* JMColumnMenu */, 108 | CB0FCF831FDFA0310075C50B /* JMColumnMenuTests */, 109 | CB0FCF8E1FDFA0310075C50B /* JMColumnMenuUITests */, 110 | CB0FCF691FDFA0310075C50B /* Products */, 111 | ); 112 | sourceTree = ""; 113 | }; 114 | CB0FCF691FDFA0310075C50B /* Products */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | CB0FCF681FDFA0310075C50B /* JMColumnMenu.app */, 118 | CB0FCF801FDFA0310075C50B /* JMColumnMenuTests.xctest */, 119 | CB0FCF8B1FDFA0310075C50B /* JMColumnMenuUITests.xctest */, 120 | ); 121 | name = Products; 122 | sourceTree = ""; 123 | }; 124 | CB0FCF6A1FDFA0310075C50B /* JMColumnMenu */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | CB0FCF9D1FDFA0B30075C50B /* JMColumnMenu */, 128 | CB0FCF6B1FDFA0310075C50B /* AppDelegate.h */, 129 | CB0FCF6C1FDFA0310075C50B /* AppDelegate.m */, 130 | CB0FCF6E1FDFA0310075C50B /* ViewController.h */, 131 | CB0FCF6F1FDFA0310075C50B /* ViewController.m */, 132 | CB0FCF711FDFA0310075C50B /* Main.storyboard */, 133 | CB0FCF741FDFA0310075C50B /* Assets.xcassets */, 134 | CB0FCF761FDFA0310075C50B /* LaunchScreen.storyboard */, 135 | CB0FCF791FDFA0310075C50B /* Info.plist */, 136 | CB0FCF7A1FDFA0310075C50B /* main.m */, 137 | ); 138 | path = JMColumnMenu; 139 | sourceTree = ""; 140 | }; 141 | CB0FCF831FDFA0310075C50B /* JMColumnMenuTests */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | CB0FCF841FDFA0310075C50B /* JMColumnMenuTests.m */, 145 | CB0FCF861FDFA0310075C50B /* Info.plist */, 146 | ); 147 | path = JMColumnMenuTests; 148 | sourceTree = ""; 149 | }; 150 | CB0FCF8E1FDFA0310075C50B /* JMColumnMenuUITests */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | CB0FCF8F1FDFA0310075C50B /* JMColumnMenuUITests.m */, 154 | CB0FCF911FDFA0310075C50B /* Info.plist */, 155 | ); 156 | path = JMColumnMenuUITests; 157 | sourceTree = ""; 158 | }; 159 | CB0FCF9D1FDFA0B30075C50B /* JMColumnMenu */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | CB6FF4FD1FE0EE6600BA9A39 /* JMColumnMenu.bundle */, 163 | CB6FF4FF1FE0EEA500BA9A39 /* JMColumnMenu.h */, 164 | CB0FCF9F1FDFA0B30075C50B /* JMColumnMenu.m */, 165 | CB0FCFA61FDFA0B30075C50B /* JMConfig.h */, 166 | CB0FCFA11FDFA0B30075C50B /* JMConfig.m */, 167 | CB0FCFA21FDFA0B30075C50B /* JMColumnMenuCell.h */, 168 | CB0FCFA81FDFA0B30075C50B /* JMColumnMenuCell.m */, 169 | CB0FCFA51FDFA0B30075C50B /* JMColumnMenuModel.h */, 170 | CB0FCF9E1FDFA0B30075C50B /* JMColumnMenuModel.m */, 171 | CB0FCFA31FDFA0B30075C50B /* JMColumnMenuHeaderView.h */, 172 | CB0FCFAA1FDFA0B30075C50B /* JMColumnMenuHeaderView.m */, 173 | CBAA51971FE7828E007BFEEE /* JMColumnMenuFooterView.h */, 174 | CBAA51981FE7828E007BFEEE /* JMColumnMenuFooterView.m */, 175 | CB0FCFA71FDFA0B30075C50B /* UIView+JM.h */, 176 | CB0FCFA01FDFA0B30075C50B /* UIView+JM.m */, 177 | ); 178 | path = JMColumnMenu; 179 | sourceTree = ""; 180 | }; 181 | /* End PBXGroup section */ 182 | 183 | /* Begin PBXNativeTarget section */ 184 | CB0FCF671FDFA0310075C50B /* JMColumnMenu */ = { 185 | isa = PBXNativeTarget; 186 | buildConfigurationList = CB0FCF941FDFA0310075C50B /* Build configuration list for PBXNativeTarget "JMColumnMenu" */; 187 | buildPhases = ( 188 | CB0FCF641FDFA0310075C50B /* Sources */, 189 | CB0FCF651FDFA0310075C50B /* Frameworks */, 190 | CB0FCF661FDFA0310075C50B /* Resources */, 191 | ); 192 | buildRules = ( 193 | ); 194 | dependencies = ( 195 | ); 196 | name = JMColumnMenu; 197 | productName = JMColumnMenu; 198 | productReference = CB0FCF681FDFA0310075C50B /* JMColumnMenu.app */; 199 | productType = "com.apple.product-type.application"; 200 | }; 201 | CB0FCF7F1FDFA0310075C50B /* JMColumnMenuTests */ = { 202 | isa = PBXNativeTarget; 203 | buildConfigurationList = CB0FCF971FDFA0310075C50B /* Build configuration list for PBXNativeTarget "JMColumnMenuTests" */; 204 | buildPhases = ( 205 | CB0FCF7C1FDFA0310075C50B /* Sources */, 206 | CB0FCF7D1FDFA0310075C50B /* Frameworks */, 207 | CB0FCF7E1FDFA0310075C50B /* Resources */, 208 | ); 209 | buildRules = ( 210 | ); 211 | dependencies = ( 212 | CB0FCF821FDFA0310075C50B /* PBXTargetDependency */, 213 | ); 214 | name = JMColumnMenuTests; 215 | productName = JMColumnMenuTests; 216 | productReference = CB0FCF801FDFA0310075C50B /* JMColumnMenuTests.xctest */; 217 | productType = "com.apple.product-type.bundle.unit-test"; 218 | }; 219 | CB0FCF8A1FDFA0310075C50B /* JMColumnMenuUITests */ = { 220 | isa = PBXNativeTarget; 221 | buildConfigurationList = CB0FCF9A1FDFA0310075C50B /* Build configuration list for PBXNativeTarget "JMColumnMenuUITests" */; 222 | buildPhases = ( 223 | CB0FCF871FDFA0310075C50B /* Sources */, 224 | CB0FCF881FDFA0310075C50B /* Frameworks */, 225 | CB0FCF891FDFA0310075C50B /* Resources */, 226 | ); 227 | buildRules = ( 228 | ); 229 | dependencies = ( 230 | CB0FCF8D1FDFA0310075C50B /* PBXTargetDependency */, 231 | ); 232 | name = JMColumnMenuUITests; 233 | productName = JMColumnMenuUITests; 234 | productReference = CB0FCF8B1FDFA0310075C50B /* JMColumnMenuUITests.xctest */; 235 | productType = "com.apple.product-type.bundle.ui-testing"; 236 | }; 237 | /* End PBXNativeTarget section */ 238 | 239 | /* Begin PBXProject section */ 240 | CB0FCF601FDFA0310075C50B /* Project object */ = { 241 | isa = PBXProject; 242 | attributes = { 243 | LastUpgradeCheck = 0910; 244 | ORGANIZATIONNAME = ljm; 245 | TargetAttributes = { 246 | CB0FCF671FDFA0310075C50B = { 247 | CreatedOnToolsVersion = 9.1; 248 | ProvisioningStyle = Automatic; 249 | }; 250 | CB0FCF7F1FDFA0310075C50B = { 251 | CreatedOnToolsVersion = 9.1; 252 | ProvisioningStyle = Automatic; 253 | TestTargetID = CB0FCF671FDFA0310075C50B; 254 | }; 255 | CB0FCF8A1FDFA0310075C50B = { 256 | CreatedOnToolsVersion = 9.1; 257 | ProvisioningStyle = Automatic; 258 | TestTargetID = CB0FCF671FDFA0310075C50B; 259 | }; 260 | }; 261 | }; 262 | buildConfigurationList = CB0FCF631FDFA0310075C50B /* Build configuration list for PBXProject "JMColumnMenu" */; 263 | compatibilityVersion = "Xcode 8.0"; 264 | developmentRegion = en; 265 | hasScannedForEncodings = 0; 266 | knownRegions = ( 267 | en, 268 | Base, 269 | ); 270 | mainGroup = CB0FCF5F1FDFA0310075C50B; 271 | productRefGroup = CB0FCF691FDFA0310075C50B /* Products */; 272 | projectDirPath = ""; 273 | projectRoot = ""; 274 | targets = ( 275 | CB0FCF671FDFA0310075C50B /* JMColumnMenu */, 276 | CB0FCF7F1FDFA0310075C50B /* JMColumnMenuTests */, 277 | CB0FCF8A1FDFA0310075C50B /* JMColumnMenuUITests */, 278 | ); 279 | }; 280 | /* End PBXProject section */ 281 | 282 | /* Begin PBXResourcesBuildPhase section */ 283 | CB0FCF661FDFA0310075C50B /* Resources */ = { 284 | isa = PBXResourcesBuildPhase; 285 | buildActionMask = 2147483647; 286 | files = ( 287 | CB0FCF781FDFA0310075C50B /* LaunchScreen.storyboard in Resources */, 288 | CB6FF4FE1FE0EE6600BA9A39 /* JMColumnMenu.bundle in Resources */, 289 | CB0FCF751FDFA0310075C50B /* Assets.xcassets in Resources */, 290 | CB0FCF731FDFA0310075C50B /* Main.storyboard in Resources */, 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | }; 294 | CB0FCF7E1FDFA0310075C50B /* Resources */ = { 295 | isa = PBXResourcesBuildPhase; 296 | buildActionMask = 2147483647; 297 | files = ( 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | CB0FCF891FDFA0310075C50B /* Resources */ = { 302 | isa = PBXResourcesBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | }; 308 | /* End PBXResourcesBuildPhase section */ 309 | 310 | /* Begin PBXSourcesBuildPhase section */ 311 | CB0FCF641FDFA0310075C50B /* Sources */ = { 312 | isa = PBXSourcesBuildPhase; 313 | buildActionMask = 2147483647; 314 | files = ( 315 | CB0FCFAE1FDFA0B40075C50B /* JMConfig.m in Sources */, 316 | CB0FCF701FDFA0310075C50B /* ViewController.m in Sources */, 317 | CB0FCFAD1FDFA0B40075C50B /* UIView+JM.m in Sources */, 318 | CB0FCFAC1FDFA0B40075C50B /* JMColumnMenu.m in Sources */, 319 | CB0FCFAB1FDFA0B40075C50B /* JMColumnMenuModel.m in Sources */, 320 | CB0FCF7B1FDFA0310075C50B /* main.m in Sources */, 321 | CB0FCFB11FDFA0B40075C50B /* JMColumnMenuHeaderView.m in Sources */, 322 | CBAA51991FE7828E007BFEEE /* JMColumnMenuFooterView.m in Sources */, 323 | CB0FCF6D1FDFA0310075C50B /* AppDelegate.m in Sources */, 324 | CB0FCFAF1FDFA0B40075C50B /* JMColumnMenuCell.m in Sources */, 325 | ); 326 | runOnlyForDeploymentPostprocessing = 0; 327 | }; 328 | CB0FCF7C1FDFA0310075C50B /* Sources */ = { 329 | isa = PBXSourcesBuildPhase; 330 | buildActionMask = 2147483647; 331 | files = ( 332 | CB0FCF851FDFA0310075C50B /* JMColumnMenuTests.m in Sources */, 333 | ); 334 | runOnlyForDeploymentPostprocessing = 0; 335 | }; 336 | CB0FCF871FDFA0310075C50B /* Sources */ = { 337 | isa = PBXSourcesBuildPhase; 338 | buildActionMask = 2147483647; 339 | files = ( 340 | CB0FCF901FDFA0310075C50B /* JMColumnMenuUITests.m in Sources */, 341 | ); 342 | runOnlyForDeploymentPostprocessing = 0; 343 | }; 344 | /* End PBXSourcesBuildPhase section */ 345 | 346 | /* Begin PBXTargetDependency section */ 347 | CB0FCF821FDFA0310075C50B /* PBXTargetDependency */ = { 348 | isa = PBXTargetDependency; 349 | target = CB0FCF671FDFA0310075C50B /* JMColumnMenu */; 350 | targetProxy = CB0FCF811FDFA0310075C50B /* PBXContainerItemProxy */; 351 | }; 352 | CB0FCF8D1FDFA0310075C50B /* PBXTargetDependency */ = { 353 | isa = PBXTargetDependency; 354 | target = CB0FCF671FDFA0310075C50B /* JMColumnMenu */; 355 | targetProxy = CB0FCF8C1FDFA0310075C50B /* PBXContainerItemProxy */; 356 | }; 357 | /* End PBXTargetDependency section */ 358 | 359 | /* Begin PBXVariantGroup section */ 360 | CB0FCF711FDFA0310075C50B /* Main.storyboard */ = { 361 | isa = PBXVariantGroup; 362 | children = ( 363 | CB0FCF721FDFA0310075C50B /* Base */, 364 | ); 365 | name = Main.storyboard; 366 | sourceTree = ""; 367 | }; 368 | CB0FCF761FDFA0310075C50B /* LaunchScreen.storyboard */ = { 369 | isa = PBXVariantGroup; 370 | children = ( 371 | CB0FCF771FDFA0310075C50B /* Base */, 372 | ); 373 | name = LaunchScreen.storyboard; 374 | sourceTree = ""; 375 | }; 376 | /* End PBXVariantGroup section */ 377 | 378 | /* Begin XCBuildConfiguration section */ 379 | CB0FCF921FDFA0310075C50B /* Debug */ = { 380 | isa = XCBuildConfiguration; 381 | buildSettings = { 382 | ALWAYS_SEARCH_USER_PATHS = NO; 383 | CLANG_ANALYZER_NONNULL = YES; 384 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 385 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 386 | CLANG_CXX_LIBRARY = "libc++"; 387 | CLANG_ENABLE_MODULES = YES; 388 | CLANG_ENABLE_OBJC_ARC = YES; 389 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 390 | CLANG_WARN_BOOL_CONVERSION = YES; 391 | CLANG_WARN_COMMA = YES; 392 | CLANG_WARN_CONSTANT_CONVERSION = YES; 393 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 394 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 395 | CLANG_WARN_EMPTY_BODY = YES; 396 | CLANG_WARN_ENUM_CONVERSION = YES; 397 | CLANG_WARN_INFINITE_RECURSION = YES; 398 | CLANG_WARN_INT_CONVERSION = YES; 399 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 400 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 401 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 402 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 403 | CLANG_WARN_STRICT_PROTOTYPES = YES; 404 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 405 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 406 | CLANG_WARN_UNREACHABLE_CODE = YES; 407 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 408 | CODE_SIGN_IDENTITY = "iPhone Developer"; 409 | COPY_PHASE_STRIP = NO; 410 | DEBUG_INFORMATION_FORMAT = dwarf; 411 | ENABLE_STRICT_OBJC_MSGSEND = YES; 412 | ENABLE_TESTABILITY = YES; 413 | GCC_C_LANGUAGE_STANDARD = gnu11; 414 | GCC_DYNAMIC_NO_PIC = NO; 415 | GCC_NO_COMMON_BLOCKS = YES; 416 | GCC_OPTIMIZATION_LEVEL = 0; 417 | GCC_PREPROCESSOR_DEFINITIONS = ( 418 | "DEBUG=1", 419 | "$(inherited)", 420 | ); 421 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 422 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 423 | GCC_WARN_UNDECLARED_SELECTOR = YES; 424 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 425 | GCC_WARN_UNUSED_FUNCTION = YES; 426 | GCC_WARN_UNUSED_VARIABLE = YES; 427 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 428 | MTL_ENABLE_DEBUG_INFO = YES; 429 | ONLY_ACTIVE_ARCH = YES; 430 | SDKROOT = iphoneos; 431 | }; 432 | name = Debug; 433 | }; 434 | CB0FCF931FDFA0310075C50B /* Release */ = { 435 | isa = XCBuildConfiguration; 436 | buildSettings = { 437 | ALWAYS_SEARCH_USER_PATHS = NO; 438 | CLANG_ANALYZER_NONNULL = YES; 439 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 440 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 441 | CLANG_CXX_LIBRARY = "libc++"; 442 | CLANG_ENABLE_MODULES = YES; 443 | CLANG_ENABLE_OBJC_ARC = YES; 444 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 445 | CLANG_WARN_BOOL_CONVERSION = YES; 446 | CLANG_WARN_COMMA = YES; 447 | CLANG_WARN_CONSTANT_CONVERSION = YES; 448 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 449 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 450 | CLANG_WARN_EMPTY_BODY = YES; 451 | CLANG_WARN_ENUM_CONVERSION = YES; 452 | CLANG_WARN_INFINITE_RECURSION = YES; 453 | CLANG_WARN_INT_CONVERSION = YES; 454 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 455 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 456 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 457 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 458 | CLANG_WARN_STRICT_PROTOTYPES = YES; 459 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 460 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 461 | CLANG_WARN_UNREACHABLE_CODE = YES; 462 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 463 | CODE_SIGN_IDENTITY = "iPhone Developer"; 464 | COPY_PHASE_STRIP = NO; 465 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 466 | ENABLE_NS_ASSERTIONS = NO; 467 | ENABLE_STRICT_OBJC_MSGSEND = YES; 468 | GCC_C_LANGUAGE_STANDARD = gnu11; 469 | GCC_NO_COMMON_BLOCKS = YES; 470 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 471 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 472 | GCC_WARN_UNDECLARED_SELECTOR = YES; 473 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 474 | GCC_WARN_UNUSED_FUNCTION = YES; 475 | GCC_WARN_UNUSED_VARIABLE = YES; 476 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 477 | MTL_ENABLE_DEBUG_INFO = NO; 478 | SDKROOT = iphoneos; 479 | VALIDATE_PRODUCT = YES; 480 | }; 481 | name = Release; 482 | }; 483 | CB0FCF951FDFA0310075C50B /* Debug */ = { 484 | isa = XCBuildConfiguration; 485 | buildSettings = { 486 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 487 | CODE_SIGN_STYLE = Automatic; 488 | INFOPLIST_FILE = JMColumnMenu/Info.plist; 489 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 490 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 491 | PRODUCT_BUNDLE_IDENTIFIER = com.laopo.JMColumnMenu; 492 | PRODUCT_NAME = "$(TARGET_NAME)"; 493 | TARGETED_DEVICE_FAMILY = 1; 494 | }; 495 | name = Debug; 496 | }; 497 | CB0FCF961FDFA0310075C50B /* Release */ = { 498 | isa = XCBuildConfiguration; 499 | buildSettings = { 500 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 501 | CODE_SIGN_STYLE = Automatic; 502 | INFOPLIST_FILE = JMColumnMenu/Info.plist; 503 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 504 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 505 | PRODUCT_BUNDLE_IDENTIFIER = com.laopo.JMColumnMenu; 506 | PRODUCT_NAME = "$(TARGET_NAME)"; 507 | TARGETED_DEVICE_FAMILY = 1; 508 | }; 509 | name = Release; 510 | }; 511 | CB0FCF981FDFA0310075C50B /* Debug */ = { 512 | isa = XCBuildConfiguration; 513 | buildSettings = { 514 | BUNDLE_LOADER = "$(TEST_HOST)"; 515 | CODE_SIGN_STYLE = Automatic; 516 | INFOPLIST_FILE = JMColumnMenuTests/Info.plist; 517 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 518 | PRODUCT_BUNDLE_IDENTIFIER = com.laopo.JMColumnMenuTests; 519 | PRODUCT_NAME = "$(TARGET_NAME)"; 520 | TARGETED_DEVICE_FAMILY = "1,2"; 521 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JMColumnMenu.app/JMColumnMenu"; 522 | }; 523 | name = Debug; 524 | }; 525 | CB0FCF991FDFA0310075C50B /* Release */ = { 526 | isa = XCBuildConfiguration; 527 | buildSettings = { 528 | BUNDLE_LOADER = "$(TEST_HOST)"; 529 | CODE_SIGN_STYLE = Automatic; 530 | INFOPLIST_FILE = JMColumnMenuTests/Info.plist; 531 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 532 | PRODUCT_BUNDLE_IDENTIFIER = com.laopo.JMColumnMenuTests; 533 | PRODUCT_NAME = "$(TARGET_NAME)"; 534 | TARGETED_DEVICE_FAMILY = "1,2"; 535 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JMColumnMenu.app/JMColumnMenu"; 536 | }; 537 | name = Release; 538 | }; 539 | CB0FCF9B1FDFA0310075C50B /* Debug */ = { 540 | isa = XCBuildConfiguration; 541 | buildSettings = { 542 | CODE_SIGN_STYLE = Automatic; 543 | INFOPLIST_FILE = JMColumnMenuUITests/Info.plist; 544 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 545 | PRODUCT_BUNDLE_IDENTIFIER = com.laopo.JMColumnMenuUITests; 546 | PRODUCT_NAME = "$(TARGET_NAME)"; 547 | TARGETED_DEVICE_FAMILY = "1,2"; 548 | TEST_TARGET_NAME = JMColumnMenu; 549 | }; 550 | name = Debug; 551 | }; 552 | CB0FCF9C1FDFA0310075C50B /* Release */ = { 553 | isa = XCBuildConfiguration; 554 | buildSettings = { 555 | CODE_SIGN_STYLE = Automatic; 556 | INFOPLIST_FILE = JMColumnMenuUITests/Info.plist; 557 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 558 | PRODUCT_BUNDLE_IDENTIFIER = com.laopo.JMColumnMenuUITests; 559 | PRODUCT_NAME = "$(TARGET_NAME)"; 560 | TARGETED_DEVICE_FAMILY = "1,2"; 561 | TEST_TARGET_NAME = JMColumnMenu; 562 | }; 563 | name = Release; 564 | }; 565 | /* End XCBuildConfiguration section */ 566 | 567 | /* Begin XCConfigurationList section */ 568 | CB0FCF631FDFA0310075C50B /* Build configuration list for PBXProject "JMColumnMenu" */ = { 569 | isa = XCConfigurationList; 570 | buildConfigurations = ( 571 | CB0FCF921FDFA0310075C50B /* Debug */, 572 | CB0FCF931FDFA0310075C50B /* Release */, 573 | ); 574 | defaultConfigurationIsVisible = 0; 575 | defaultConfigurationName = Release; 576 | }; 577 | CB0FCF941FDFA0310075C50B /* Build configuration list for PBXNativeTarget "JMColumnMenu" */ = { 578 | isa = XCConfigurationList; 579 | buildConfigurations = ( 580 | CB0FCF951FDFA0310075C50B /* Debug */, 581 | CB0FCF961FDFA0310075C50B /* Release */, 582 | ); 583 | defaultConfigurationIsVisible = 0; 584 | defaultConfigurationName = Release; 585 | }; 586 | CB0FCF971FDFA0310075C50B /* Build configuration list for PBXNativeTarget "JMColumnMenuTests" */ = { 587 | isa = XCConfigurationList; 588 | buildConfigurations = ( 589 | CB0FCF981FDFA0310075C50B /* Debug */, 590 | CB0FCF991FDFA0310075C50B /* Release */, 591 | ); 592 | defaultConfigurationIsVisible = 0; 593 | defaultConfigurationName = Release; 594 | }; 595 | CB0FCF9A1FDFA0310075C50B /* Build configuration list for PBXNativeTarget "JMColumnMenuUITests" */ = { 596 | isa = XCConfigurationList; 597 | buildConfigurations = ( 598 | CB0FCF9B1FDFA0310075C50B /* Debug */, 599 | CB0FCF9C1FDFA0310075C50B /* Release */, 600 | ); 601 | defaultConfigurationIsVisible = 0; 602 | defaultConfigurationName = Release; 603 | }; 604 | /* End XCConfigurationList section */ 605 | }; 606 | rootObject = CB0FCF601FDFA0310075C50B /* Project object */; 607 | } 608 | -------------------------------------------------------------------------------- /JMColumnMenu.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JMColumnMenu/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // JMColumnMenu 4 | // 5 | // Created by JM on 2017/12/12. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /JMColumnMenu/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // JMColumnMenu 4 | // 5 | // Created by JM on 2017/12/12. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /JMColumnMenu/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /JMColumnMenu/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /JMColumnMenu/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 | -------------------------------------------------------------------------------- /JMColumnMenu/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMColumnMenu.bundle/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JunAILiang/JMColumnMenu/a9c9b8ea5a55f4ff9c3d60366e4c0b2499d20383/JMColumnMenu/JMColumnMenu/JMColumnMenu.bundle/add.png -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMColumnMenu.bundle/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JunAILiang/JMColumnMenu/a9c9b8ea5a55f4ff9c3d60366e4c0b2499d20383/JMColumnMenu/JMColumnMenu/JMColumnMenu.bundle/close.png -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMColumnMenu.bundle/close_one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JunAILiang/JMColumnMenu/a9c9b8ea5a55f4ff9c3d60366e4c0b2499d20383/JMColumnMenu/JMColumnMenu/JMColumnMenu.bundle/close_one.png -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMColumnMenu.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMColumnMenuController.h 3 | // JMCollectionView 4 | // 5 | // Created by JM on 2017/12/11. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger, JMColumnMenuType) { 12 | JMColumnMenuTypeTencent, //腾讯新闻 13 | JMColumnMenuTypeTouTiao, //今日头条 14 | }; 15 | 16 | @protocol JMColumnMenuDelegate 17 | 18 | /** 19 | * tagsArr 排序后的选择数组 20 | * otherArr 排序后未选择数组 21 | */ 22 | - (void)columnMenuTagsArr:(NSMutableArray *)tagsArr OtherArr:(NSMutableArray *)otherArr; 23 | 24 | /** 25 | * 点击的标题 26 | * 对应的index 27 | */ 28 | - (void)columnMenuDidSelectTitle:(NSString *)title Index:(NSInteger)index; 29 | 30 | @end 31 | 32 | @interface JMColumnMenu : UIViewController 33 | 34 | /** 35 | * 初始化方法 36 | */ 37 | + (instancetype)columnMenuWithTagsArrM:(NSMutableArray *)tagsArrM OtherArrM:(NSMutableArray *)otherArrM Type:(JMColumnMenuType)type Delegate:(id)delegate; 38 | - (instancetype)initWithTagsArrM:(NSMutableArray *)tagsArrM OtherArrM:(NSMutableArray *)otherArrM Type:(JMColumnMenuType)type Delegate:(id)delegate; 39 | 40 | /** 代理 */ 41 | @property (nonatomic, weak) id delegate; 42 | /** 类型 */ 43 | @property (nonatomic, assign) JMColumnMenuType type; 44 | /** 导航栏的背景颜色 */ 45 | @property (nonatomic, strong) UIColor *navBackgroundColor; 46 | /** 导航栏文字颜色 */ 47 | @property (nonatomic, strong) UIColor *navTitleColor; 48 | /** 导航栏文字 */ 49 | @property (nonatomic, copy) NSString *navTitleStr; 50 | /** 导航栏右侧关闭按钮 */ 51 | @property (nonatomic, strong) UIImage *navRightIV; 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMColumnMenu.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMColumnMenuController.m 3 | // JMCollectionView 4 | // 5 | // Created by JM on 2017/12/11. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import "JMColumnMenu.h" 10 | #import "JMColumnMenuCell.h" 11 | #import "JMColumnMenuHeaderView.h" 12 | #import "JMColumnMenuFooterView.h" 13 | #import "JMColumnMenuModel.h" 14 | #import "UIView+JM.h" 15 | 16 | #define CELLID @"CollectionViewCell" 17 | #define HEADERID @"headerId" 18 | #define FOOTERID @"footerId" 19 | 20 | @interface JMColumnMenu () 21 | 22 | /** 导航栏的view */ 23 | @property (nonatomic, weak) UIView *navView; 24 | /** navTitle */ 25 | @property (nonatomic, weak) UILabel *navTitle; 26 | /** navColseBtn */ 27 | @property (nonatomic, weak) UIButton *navCloseBtn; 28 | /** tags */ 29 | @property (nonatomic, strong) NSMutableArray *tagsArrM; 30 | /** others */ 31 | @property (nonatomic, strong) NSMutableArray *otherArrM; 32 | /** CollectionView */ 33 | @property (nonatomic, weak) UICollectionView *collectionView; 34 | /** 头部视图 */ 35 | @property (nonatomic, weak) JMColumnMenuHeaderView *headerView; 36 | /** 头部视图1 */ 37 | @property (nonatomic, weak) JMColumnMenuFooterView *footerView; 38 | /** 长按手势 */ 39 | @property (nonatomic, strong) UILongPressGestureRecognizer *longPress; 40 | /** 引用headView编辑字符串 */ 41 | @property (nonatomic, copy) NSString *editBtnStr; 42 | 43 | @end 44 | 45 | @implementation JMColumnMenu 46 | 47 | - (NSMutableArray *)tagsArrM { 48 | if (!_tagsArrM) { 49 | _tagsArrM = [NSMutableArray array]; 50 | } 51 | return _tagsArrM; 52 | } 53 | 54 | - (NSMutableArray *)otherArrM { 55 | if (!_otherArrM) { 56 | _otherArrM = [NSMutableArray array]; 57 | } 58 | return _otherArrM; 59 | } 60 | 61 | + (instancetype)columnMenuWithTagsArrM:(NSMutableArray *)tagsArrM OtherArrM:(NSMutableArray *)otherArrM Type:(JMColumnMenuType)type Delegate:(id)delegate{ 62 | return [[self alloc] initWithTagsArrM:tagsArrM OtherArrM:otherArrM Type:type Delegate:delegate]; 63 | } 64 | 65 | - (instancetype)initWithTagsArrM:(NSMutableArray *)tagsArrM OtherArrM:(NSMutableArray *)otherArrM Type:(JMColumnMenuType)type Delegate:(id)delegate{ 66 | if (self = [super init]) { 67 | self.type = type; 68 | self.delegate = delegate; 69 | self.editBtnStr = @"编辑"; 70 | 71 | for (int i = 0; i < tagsArrM.count; i++) { 72 | JMColumnMenuModel *model = [[JMColumnMenuModel alloc] init]; 73 | model.title = tagsArrM[i]; 74 | model.type = type; 75 | if (self.type == JMColumnMenuTypeTouTiao) { 76 | model.showAdd = NO; 77 | model.selected = NO; 78 | if (i == 0) { 79 | model.resident = YES; 80 | } 81 | } else if (type == JMColumnMenuTypeTencent) { 82 | if (i != 0) { 83 | model.selected = YES; 84 | } else { 85 | model.selected = NO; 86 | model.resident = YES; 87 | } 88 | } 89 | [self.tagsArrM addObject:model]; 90 | } 91 | 92 | for (NSString *title in otherArrM) { 93 | JMColumnMenuModel *model = [[JMColumnMenuModel alloc] init]; 94 | model.title = title; 95 | if (self.type == JMColumnMenuTypeTouTiao) { 96 | model.showAdd = YES; 97 | } 98 | model.type = type; 99 | model.selected = NO; 100 | [self.otherArrM addObject:model]; 101 | } 102 | 103 | //初始化UI 104 | [self initColumnMenuUI]; 105 | } 106 | return self; 107 | } 108 | 109 | - (void)viewDidLoad { 110 | [super viewDidLoad]; 111 | self.automaticallyAdjustsScrollViewInsets = NO; 112 | } 113 | 114 | #pragma mark - 初始化UI 115 | - (void)initColumnMenuUI { 116 | UIView *navView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 64)]; 117 | navView.backgroundColor = [UIColor blackColor]; 118 | self.navView = navView; 119 | [self.view addSubview:navView]; 120 | 121 | UILabel *navTitle = [[UILabel alloc] initWithFrame:CGRectMake(self.navView.centerX - 100, self.navView.centerY, 200, 20)]; 122 | navTitle.text = @"频道定制"; 123 | navTitle.textAlignment = NSTextAlignmentCenter; 124 | navTitle.textColor = [UIColor whiteColor]; 125 | self.navTitle = navTitle; 126 | [self.navView addSubview:navTitle]; 127 | 128 | UIButton *navCloseBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 129 | navCloseBtn.frame = CGRectMake(self.navView.width - 30, CGRectGetMinY(self.navTitle.frame), 20, 20); 130 | NSBundle *bundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"JMColumnMenu" ofType:@"bundle"]]; 131 | NSString *path = [bundle pathForResource:@"close_one" ofType:@"png"]; 132 | [navCloseBtn setImage:[UIImage imageWithContentsOfFile:path] forState:UIControlStateNormal]; 133 | self.navCloseBtn = navCloseBtn; 134 | [navCloseBtn addTarget:self action:@selector(navCloseBtnClick) forControlEvents:UIControlEventTouchUpInside]; 135 | [self.navView addSubview:navCloseBtn]; 136 | 137 | //视图布局对象 138 | UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; 139 | layout.sectionInset = UIEdgeInsetsMake(0, 0, 10, 0); 140 | 141 | //UICollectionView 142 | UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.navView.frame), self.view.width, self.view.height - self.navView.height) collectionViewLayout:layout]; 143 | collectionView.delegate = self; 144 | collectionView.dataSource = self; 145 | collectionView.backgroundColor = [UIColor whiteColor]; 146 | self.collectionView = collectionView; 147 | [self.view addSubview:self.collectionView]; 148 | 149 | //注册cell 150 | [self.collectionView registerClass:[JMColumnMenuCell class] forCellWithReuseIdentifier:CELLID]; 151 | [self.collectionView registerClass:[JMColumnMenuHeaderView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:HEADERID]; 152 | [self.collectionView registerClass:[JMColumnMenuFooterView class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:FOOTERID]; 153 | 154 | //添加长按的手势 155 | self.longPress = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPress:)]; 156 | // if (self.type == JMColumnMenuTypeTencent) { 157 | [self.collectionView addGestureRecognizer:self.longPress]; 158 | // } 159 | 160 | } 161 | 162 | #pragma mark - 手势识别 163 | - (void)longPress:(UIGestureRecognizer *)longPress { 164 | if ([self.editBtnStr containsString:@"编辑"] && self.type == JMColumnMenuTypeTouTiao) { 165 | self.editBtnStr = @"完成"; 166 | for (int i = 0; i < self.tagsArrM.count; i++) { 167 | JMColumnMenuModel *model = self.tagsArrM[i]; 168 | if (i != 0) { 169 | model.selected = YES; 170 | } 171 | } 172 | // NSIndexPath *indexPath = [NSIndexPath] 173 | NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:0]; 174 | [self.collectionView reloadSections:indexSet]; 175 | // [self.collectionView reloadData]; 176 | } 177 | // NSLog(@"长按手势开始"); 178 | //获取点击在collectionView的坐标 179 | CGPoint point=[longPress locationInView:self.collectionView]; 180 | //从长按开始 181 | NSIndexPath *indexPath=[self.collectionView indexPathForItemAtPoint:point]; 182 | //判断是否可以移动 183 | // if (indexPath.item == 0) { 184 | // return; 185 | // } 186 | 187 | 188 | if (longPress.state == UIGestureRecognizerStateBegan) { 189 | if (indexPath.section == 0 && indexPath.item == 0) { 190 | return; 191 | } 192 | [self.collectionView beginInteractiveMovementForItemAtIndexPath:indexPath]; 193 | //长按手势状态改变 194 | // NSLog(@"开始"); 195 | } else if(longPress.state==UIGestureRecognizerStateChanged) { 196 | if (indexPath.section == 0 && indexPath.item == 0) { 197 | return; 198 | } 199 | // NSLog(@"改变"); 200 | [self.collectionView updateInteractiveMovementTargetPosition:point]; 201 | //长按手势结束 202 | } else if (longPress.state==UIGestureRecognizerStateEnded) { 203 | // NSLog(@"结束"); 204 | [self.collectionView endInteractiveMovement]; 205 | //其他情况 206 | } else { 207 | [self.collectionView cancelInteractiveMovement]; 208 | } 209 | } 210 | 211 | 212 | #pragma mark - UICollectionViewDataSource 213 | //一共有多少组 214 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { 215 | if (self.otherArrM) { 216 | return 2; 217 | } else { 218 | return 1; 219 | } 220 | } 221 | 222 | //每一组有多少个cell 223 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 224 | if (section == 0) { 225 | return self.tagsArrM.count; 226 | } else { 227 | return self.otherArrM.count; 228 | } 229 | } 230 | 231 | //每一个cell的内容 232 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 233 | JMColumnMenuCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CELLID forIndexPath:indexPath]; 234 | 235 | if (indexPath.section == 0) { 236 | cell.model = self.tagsArrM[indexPath.item]; 237 | if (indexPath.item == 0) { //第一个按钮样式区别 238 | cell.title.textColor = [UIColor redColor]; 239 | } 240 | } else { 241 | cell.model = self.otherArrM[indexPath.item]; 242 | } 243 | 244 | //关闭按钮点击事件 245 | cell.closeBtn.tag = indexPath.item; 246 | [cell.closeBtn addTarget:self action:@selector(colseBtnClick:) forControlEvents:UIControlEventTouchUpInside]; 247 | 248 | return cell; 249 | } 250 | 251 | //和tableView差不多, 可设置头部和尾部 252 | - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { 253 | if([kind isEqualToString:UICollectionElementKindSectionHeader]) 254 | { 255 | JMColumnMenuHeaderView *headerView = [self.collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:HEADERID forIndexPath:indexPath]; 256 | if (indexPath.section == 0) { 257 | headerView.titleStr = @"已选频道"; 258 | headerView.detailStr = @"按住拖动调整排序"; 259 | if (self.type == JMColumnMenuTypeTouTiao) { 260 | [headerView.editBtn setTitle:self.editBtnStr forState:UIControlStateNormal]; 261 | headerView.editBtn.hidden = NO; 262 | [headerView.editBtn addTarget:self action:@selector(headViewEditBtnClick) forControlEvents:UIControlEventTouchUpInside]; 263 | } 264 | } 265 | self.headerView = headerView; 266 | return headerView; 267 | } else if ([kind isEqualToString:UICollectionElementKindSectionFooter]) { 268 | JMColumnMenuFooterView *footerView = [self.collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:FOOTERID forIndexPath:indexPath]; 269 | if (indexPath.section == 0) { 270 | footerView.titleStr = @"频道推荐"; 271 | footerView.detailStr = @"点击添加频道"; 272 | } 273 | self.footerView = footerView; 274 | return footerView; 275 | } 276 | return nil; 277 | } 278 | 279 | #pragma mark - 头部编辑按钮点击事件 280 | - (void)headViewEditBtnClick { 281 | if ([self.editBtnStr containsString:@"编辑"]) { 282 | self.editBtnStr = @"完成"; 283 | [self.headerView.editBtn setTitle:@"完成" forState:UIControlStateNormal]; 284 | 285 | // [self.collectionView addGestureRecognizer:self.longPress]; 286 | 287 | for (int i = 0; i < self.tagsArrM.count; i++) { 288 | JMColumnMenuModel *model = self.tagsArrM[i]; 289 | if (i == 0) { 290 | model.selected = NO; 291 | } else { 292 | model.selected = YES; 293 | } 294 | } 295 | } else { 296 | self.editBtnStr = @"编辑"; 297 | [self.headerView.editBtn setTitle:@"编辑" forState:UIControlStateNormal]; 298 | 299 | // [self.collectionView removeGestureRecognizer:self.longPress]; 300 | 301 | for (int i = 0; i < self.tagsArrM.count; i++) { 302 | JMColumnMenuModel *model = self.tagsArrM[i]; 303 | if (i == 0) { 304 | model.selected = NO; 305 | } else { 306 | model.selected = NO; 307 | } 308 | } 309 | } 310 | [self.collectionView reloadData]; 311 | } 312 | 313 | //每一个分组的上左下右间距 314 | -(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section 315 | { 316 | return UIEdgeInsetsMake(0, 10, 4, 10); 317 | } 318 | 319 | //头部视图的大小 320 | -(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{ 321 | if (section == 0) { 322 | return CGSizeMake(self.view.width, 40); 323 | } else { 324 | return CGSizeMake(0, 0); 325 | } 326 | } 327 | 328 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section { 329 | if (section == 0) { 330 | return CGSizeMake(self.view.width, 40); 331 | } else { 332 | return CGSizeMake(0, 0); 333 | } 334 | } 335 | 336 | //定义每一个cell的大小 337 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ 338 | 339 | return CGSizeMake(self.collectionView.width * 0.25 - 10, 53); 340 | } 341 | 342 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{ 343 | return 4; 344 | } 345 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{ 346 | return 5; 347 | } 348 | 349 | //cell的点击事件 350 | -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ 351 | JMColumnMenuModel *model; 352 | if (indexPath.section == 0) { 353 | model = self.tagsArrM[indexPath.item]; 354 | //判断是否是编辑状态 355 | if ([self.editBtnStr containsString:@"编辑"]) { 356 | //判断是否是头条,是就直接回调出去 357 | if (model.type == JMColumnMenuTypeTouTiao) { //头条 358 | if ([self.delegate respondsToSelector:@selector(columnMenuDidSelectTitle:Index:)]) { 359 | [self.delegate columnMenuDidSelectTitle:model.title Index:indexPath.item]; 360 | } 361 | [self navCloseBtnClick]; 362 | return; 363 | } 364 | } 365 | 366 | //判断是否可以删除 367 | if (model.resident) { 368 | return; 369 | } 370 | 371 | model.selected = NO; 372 | if (model.type == JMColumnMenuTypeTencent) { 373 | model.showAdd = NO; 374 | } else if (model.type == JMColumnMenuTypeTouTiao) { 375 | model.showAdd = YES; 376 | } 377 | [collectionView reloadItemsAtIndexPaths:@[indexPath]]; 378 | 379 | [self.tagsArrM removeObjectAtIndex:indexPath.item]; 380 | [self.otherArrM insertObject:model atIndex:0]; 381 | 382 | NSIndexPath *targetIndexPage = [NSIndexPath indexPathForItem:0 inSection:1]; 383 | [collectionView moveItemAtIndexPath:indexPath toIndexPath:targetIndexPage]; 384 | } else if (indexPath.section == 1) { 385 | JMColumnMenuCell *cell = (JMColumnMenuCell *)[collectionView cellForItemAtIndexPath:indexPath]; 386 | cell.closeBtn.hidden = YES; 387 | model = self.otherArrM[indexPath.item]; 388 | if (model.type == JMColumnMenuTypeTencent) { 389 | model.selected = YES; 390 | } else if (model.type == JMColumnMenuTypeTouTiao) { 391 | if ([self.editBtnStr containsString:@"编辑"]) { 392 | model.selected = NO; 393 | } else { 394 | model.selected = YES; 395 | } 396 | } 397 | model.showAdd = NO; 398 | [collectionView reloadItemsAtIndexPaths:@[indexPath]]; 399 | 400 | [self.otherArrM removeObjectAtIndex:indexPath.item]; 401 | [self.tagsArrM addObject:model]; 402 | 403 | NSIndexPath *targetIndexPage = [NSIndexPath indexPathForItem:self.tagsArrM.count-1 inSection:0]; 404 | [collectionView moveItemAtIndexPath:indexPath toIndexPath:targetIndexPage]; 405 | } 406 | 407 | [self refreshDelBtnsTag]; 408 | [self updateBlockArr]; 409 | } 410 | 411 | #pragma mark - item关闭按钮点击事件 412 | - (void)colseBtnClick:(UIButton *)sender { 413 | JMColumnMenuModel *model = self.tagsArrM[sender.tag]; 414 | model.selected = NO; 415 | NSIndexPath *indexPath = [NSIndexPath indexPathForItem:sender.tag inSection:0]; 416 | [self.collectionView reloadItemsAtIndexPaths:@[indexPath]]; 417 | 418 | [self.tagsArrM removeObjectAtIndex:sender.tag]; 419 | [self.otherArrM insertObject:model atIndex:0]; 420 | 421 | NSIndexPath *targetIndexPage = [NSIndexPath indexPathForItem:0 inSection:1]; 422 | [self.collectionView moveItemAtIndexPath:indexPath toIndexPath:targetIndexPage]; 423 | 424 | [self refreshDelBtnsTag]; 425 | [self updateBlockArr]; 426 | } 427 | 428 | //在开始移动是调动此代理方法 429 | - (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath { 430 | // NSLog(@"开始移动"); 431 | return YES; 432 | } 433 | 434 | //在移动结束的时候调用此代理方法 435 | - (void)collectionView:(UICollectionView *)collectionView moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath { 436 | // NSLog(@"结束移动"); 437 | JMColumnMenuModel *model; 438 | if (sourceIndexPath.section == 0) { 439 | model = self.tagsArrM[sourceIndexPath.item]; 440 | [self.tagsArrM removeObjectAtIndex:sourceIndexPath.item]; 441 | } else { 442 | model = self.otherArrM[sourceIndexPath.item]; 443 | [self.otherArrM removeObjectAtIndex:sourceIndexPath.item]; 444 | } 445 | 446 | if (destinationIndexPath.section == 0) { 447 | model.selected = YES; 448 | [self.tagsArrM insertObject:model atIndex:destinationIndexPath.item]; 449 | } else if (destinationIndexPath.section == 1) { 450 | model.selected = NO; 451 | [self.otherArrM insertObject:model atIndex:destinationIndexPath.item]; 452 | } 453 | 454 | [collectionView reloadItemsAtIndexPaths:@[destinationIndexPath]]; 455 | 456 | [self refreshDelBtnsTag]; 457 | [self updateBlockArr]; 458 | } 459 | 460 | #pragma mark - 刷新tag 461 | - (void)refreshDelBtnsTag { 462 | for (JMColumnMenuCell *cell in self.collectionView.visibleCells) { 463 | NSIndexPath *indexPath = [self.collectionView indexPathForCell:cell]; 464 | cell.closeBtn.tag = indexPath.item; 465 | } 466 | } 467 | 468 | #pragma mark - 更新block数组 469 | - (void)updateBlockArr { 470 | NSMutableArray *tempTagsArrM = [NSMutableArray array]; 471 | NSMutableArray *tempOtherArrM = [NSMutableArray array]; 472 | for (JMColumnMenuModel *model in self.tagsArrM) { 473 | [tempTagsArrM addObject:model.title]; 474 | } 475 | for (JMColumnMenuModel *model in self.otherArrM) { 476 | [tempOtherArrM addObject:model.title]; 477 | } 478 | 479 | if ([self.delegate respondsToSelector:@selector(columnMenuTagsArr:OtherArr:)]) { 480 | [self.delegate columnMenuTagsArr:tempTagsArrM OtherArr:tempOtherArrM]; 481 | } 482 | if (self.otherArrM.count <= 0) { 483 | self.footerView.hidden = YES; 484 | } else { 485 | self.footerView.hidden = NO; 486 | } 487 | } 488 | 489 | #pragma mark - 导航栏右侧关闭按钮点击事件 490 | - (void)navCloseBtnClick { 491 | [self dismissViewControllerAnimated:YES completion:nil]; 492 | } 493 | 494 | - (void)setNavTitleStr:(NSString *)navTitleStr { 495 | _navTitleStr = navTitleStr; 496 | self.navTitle.text = navTitleStr; 497 | } 498 | 499 | - (void)setNavBackgroundColor:(UIColor *)navBackgroundColor { 500 | _navBackgroundColor = navBackgroundColor; 501 | self.navView.backgroundColor = navBackgroundColor; 502 | } 503 | 504 | - (void)setNavTitleColor:(UIColor *)navTitleColor { 505 | _navTitleColor = navTitleColor; 506 | self.navTitle.textColor = navTitleColor; 507 | } 508 | 509 | - (void)setNavRightIV:(UIImage *)navRightIV { 510 | _navRightIV = navRightIV; 511 | [self.navCloseBtn setImage:navRightIV forState:UIControlStateNormal]; 512 | } 513 | 514 | @end 515 | -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMColumnMenuCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMColumnMenuCell.h 3 | // JMCollectionView 4 | // 5 | // Created by 刘俊敏 on 2017/12/7. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JMColumnMenuModel.h" 11 | 12 | @interface JMColumnMenuCell : UICollectionViewCell 13 | 14 | /** title */ 15 | @property (nonatomic, strong) UILabel *title; 16 | /** closeBtn */ 17 | @property (nonatomic, strong) UIButton *closeBtn; 18 | /** addbtn */ 19 | @property (nonatomic, strong) UIButton *addBtn; 20 | /** 数据模型 */ 21 | @property (nonatomic, strong) JMColumnMenuModel *model; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMColumnMenuCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMColumnMenuCell.m 3 | // JMCollectionView 4 | // 5 | // Created by 刘俊敏 on 2017/12/7. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import "JMColumnMenuCell.h" 10 | #import "UIView+JM.h" 11 | #import "JMConfig.h" 12 | 13 | @interface JMColumnMenuCell() 14 | 15 | /** 空View */ 16 | @property (nonatomic, strong) UIView *emptyView; 17 | 18 | @end 19 | 20 | @implementation JMColumnMenuCell 21 | 22 | - (instancetype)initWithFrame:(CGRect)frame { 23 | if (self = [super initWithFrame:frame]) { 24 | //空View 25 | self.emptyView = [[UIView alloc] initWithFrame:CGRectZero]; 26 | self.emptyView.backgroundColor = [JMConfig colorWithHexString:@"#f4f4f4"]; 27 | [self.contentView addSubview:self.emptyView]; 28 | 29 | //标题 30 | self.title = [[UILabel alloc] initWithFrame:CGRectZero]; 31 | self.title.font = [UIFont systemFontOfSize:15]; 32 | self.title.textAlignment = NSTextAlignmentCenter; 33 | self.title.layer.masksToBounds = YES; 34 | self.title.layer.cornerRadius = 5.f; 35 | self.title.backgroundColor = [JMConfig colorWithHexString:@"#f4f4f4"]; 36 | [self.emptyView addSubview:self.title]; 37 | 38 | //关闭按钮 39 | NSBundle *bundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"JMColumnMenu" ofType:@"bundle"]]; 40 | NSString *path = [bundle pathForResource:@"close" ofType:@"png"]; 41 | self.closeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 42 | [self.closeBtn setImage:[UIImage imageWithContentsOfFile:path] forState:UIControlStateNormal]; 43 | self.closeBtn.hidden = YES; 44 | [self.emptyView addSubview:self.closeBtn]; 45 | 46 | //添加按钮 47 | NSString *add_path = [bundle pathForResource:@"add" ofType:@"png"]; 48 | self.addBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 49 | [self.addBtn setImage:[UIImage imageWithContentsOfFile:add_path] forState:UIControlStateNormal]; 50 | self.addBtn.hidden = YES; 51 | [self.emptyView addSubview:self.addBtn]; 52 | 53 | } 54 | return self; 55 | } 56 | 57 | - (void)updateAllFrame:(JMColumnMenuModel *)model { 58 | self.emptyView.frame = CGRectMake(5, 6.5, self.contentView.width - 10, self.contentView.height - 13); 59 | 60 | self.title.size = [self returnTitleSize]; 61 | 62 | if (model.showAdd) { 63 | self.title.center = CGPointMake(self.emptyView.width / 2 + 6, self.emptyView.height / 2); 64 | } else { 65 | self.title.center = CGPointMake(self.emptyView.width / 2, self.emptyView.height / 2); 66 | } 67 | 68 | self.closeBtn.frame = CGRectMake(self.contentView.width - 16, 0, 18, 18); 69 | 70 | self.addBtn.size = CGSizeMake(10, 10); 71 | self.addBtn.centerY = self.title.centerY; 72 | self.addBtn.x = CGRectGetMinX(self.title.frame) - 12; 73 | } 74 | 75 | - (void)setModel:(JMColumnMenuModel *)model { 76 | _model = model; 77 | 78 | //标题文字处理 79 | if (model.title.length == 2) { 80 | self.title.font = [UIFont systemFontOfSize:15]; 81 | } else if (model.title.length == 3) { 82 | self.title.font = [UIFont systemFontOfSize:14]; 83 | } else if (model.title.length == 4) { 84 | self.title.font = [UIFont systemFontOfSize:13]; 85 | } else if (model.title.length > 4) { 86 | self.title.font = [UIFont systemFontOfSize:12]; 87 | } 88 | 89 | if (model.type == JMColumnMenuTypeTencent) { 90 | self.title.text = model.title; 91 | self.closeBtn.hidden = !model.selected; 92 | } else if (model.type == JMColumnMenuTypeTouTiao) { 93 | self.closeBtn.hidden = !model.selected; 94 | self.title.text = [NSString stringWithFormat:@"%@",model.title]; 95 | if (model.showAdd) { 96 | self.addBtn.hidden = NO; 97 | } else { 98 | self.addBtn.hidden = YES; 99 | } 100 | } 101 | 102 | [self updateAllFrame:model]; 103 | } 104 | 105 | - (CGSize)returnTitleSize { 106 | CGFloat maxWidth = self.emptyView.width - 12; 107 | CGSize size = [self.title.text boundingRectWithSize:CGSizeMake(maxWidth, CGFLOAT_MAX) 108 | options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin 109 | attributes:@{NSFontAttributeName:self.title.font} 110 | context:nil].size; 111 | return size; 112 | } 113 | 114 | 115 | @end 116 | -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMColumnMenuFooterView.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMColumnMenuFooterView.h 3 | // JMColumnMenu 4 | // 5 | // Created by JM on 2017/12/18. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JMColumnMenuFooterView : UICollectionReusableView 12 | 13 | /** 标题str */ 14 | @property (nonatomic, copy) NSString *titleStr; 15 | /** 描述str */ 16 | @property (nonatomic, copy) NSString *detailStr; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMColumnMenuFooterView.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMColumnMenuFooterView.m 3 | // JMColumnMenu 4 | // 5 | // Created by JM on 2017/12/18. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import "JMColumnMenuFooterView.h" 10 | #import "UIView+JM.h" 11 | 12 | @interface JMColumnMenuFooterView() 13 | 14 | /** 标题 */ 15 | @property (nonatomic, strong) UILabel *title; 16 | /** 描述 */ 17 | @property (nonatomic, strong) UILabel *detail; 18 | 19 | @end 20 | 21 | @implementation JMColumnMenuFooterView 22 | 23 | 24 | - (instancetype)initWithFrame:(CGRect)frame { 25 | if (self = [super initWithFrame:frame]) { 26 | self.backgroundColor = [UIColor whiteColor]; 27 | 28 | self.title = [[UILabel alloc] initWithFrame:CGRectZero]; 29 | self.title.font = [UIFont systemFontOfSize:16]; 30 | self.title.textColor = [UIColor blackColor]; 31 | [self addSubview:self.title]; 32 | 33 | self.detail = [[UILabel alloc] initWithFrame:CGRectZero]; 34 | self.detail.textColor = [UIColor lightGrayColor]; 35 | self.detail.font = [UIFont systemFontOfSize:14]; 36 | [self addSubview:self.detail]; 37 | 38 | [self initFrame]; 39 | } 40 | return self; 41 | } 42 | 43 | - (void)initFrame { 44 | CGFloat titleX = 12; 45 | CGFloat titleW = [self returnTitleSize].width; 46 | CGFloat titleH = 16; 47 | CGFloat titleY = self.height * 0.5 - titleH * 0.5; 48 | self.title.frame = CGRectMake(titleX, titleY, titleW, titleH); 49 | 50 | CGFloat detailW = 160; 51 | CGFloat detailH = 16; 52 | CGFloat detailY = titleY; 53 | CGFloat detailX = CGRectGetMaxX(self.title.frame) + 10; 54 | self.detail.frame = CGRectMake(detailX, detailY, detailW, detailH); 55 | 56 | } 57 | 58 | - (CGSize)returnTitleSize { 59 | CGSize size = [self.title.text boundingRectWithSize:CGSizeMake(self.width - 20, CGFLOAT_MAX) 60 | options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin 61 | attributes:@{NSFontAttributeName:self.title.font} 62 | context:nil].size; 63 | return size; 64 | } 65 | 66 | - (void)setTitleStr:(NSString *)titleStr { 67 | _titleStr = titleStr; 68 | self.title.text = titleStr; 69 | 70 | [self initFrame]; 71 | } 72 | 73 | - (void)setDetailStr:(NSString *)detailStr { 74 | _detailStr = detailStr; 75 | 76 | self.detail.text = detailStr; 77 | 78 | [self initFrame]; 79 | } 80 | 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMColumnMenuHeaderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMColumnMenuHeaderView.h 3 | // JMCollectionView 4 | // 5 | // Created by 刘俊敏 on 2017/12/7. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JMColumnMenuHeaderView : UICollectionReusableView 12 | 13 | /** 标题str */ 14 | @property (nonatomic, copy) NSString *titleStr; 15 | /** 描述str */ 16 | @property (nonatomic, copy) NSString *detailStr; 17 | 18 | /** 编辑按钮 */ 19 | @property (nonatomic, strong) UIButton *editBtn; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMColumnMenuHeaderView.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMColumnMenuHeaderView.m 3 | // JMCollectionView 4 | // 5 | // Created by 刘俊敏 on 2017/12/7. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import "JMColumnMenuHeaderView.h" 10 | #import "UIView+JM.h" 11 | 12 | @interface JMColumnMenuHeaderView() 13 | 14 | /** 标题 */ 15 | @property (nonatomic, strong) UILabel *title; 16 | /** 描述 */ 17 | @property (nonatomic, strong) UILabel *detail; 18 | 19 | @end 20 | 21 | @implementation JMColumnMenuHeaderView 22 | 23 | - (instancetype)initWithFrame:(CGRect)frame { 24 | if (self = [super initWithFrame:frame]) { 25 | self.backgroundColor = [UIColor whiteColor]; 26 | 27 | self.title = [[UILabel alloc] initWithFrame:CGRectZero]; 28 | self.title.font = [UIFont systemFontOfSize:16]; 29 | self.title.textColor = [UIColor blackColor]; 30 | [self addSubview:self.title]; 31 | 32 | self.detail = [[UILabel alloc] initWithFrame:CGRectZero]; 33 | self.detail.textColor = [UIColor lightGrayColor]; 34 | self.detail.font = [UIFont systemFontOfSize:14]; 35 | [self addSubview:self.detail]; 36 | 37 | self.editBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 38 | [self.editBtn setTitle:@"编辑" forState:UIControlStateNormal]; 39 | [self.editBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; 40 | self.editBtn.titleLabel.font = [UIFont systemFontOfSize:12]; 41 | self.editBtn.layer.masksToBounds = YES; 42 | self.editBtn.layer.cornerRadius = 6.f; 43 | self.editBtn.layer.borderColor = [UIColor redColor].CGColor; 44 | self.editBtn.layer.borderWidth = 1.f; 45 | self.editBtn.hidden = YES; 46 | [self addSubview:self.editBtn]; 47 | 48 | [self initFrame]; 49 | } 50 | return self; 51 | } 52 | 53 | - (void)initFrame { 54 | CGFloat titleX = 12; 55 | CGFloat titleW = [self returnTitleSize].width; 56 | CGFloat titleH = 16; 57 | CGFloat titleY = self.height * 0.5 - titleH * 0.5; 58 | self.title.frame = CGRectMake(titleX, titleY, titleW, titleH); 59 | 60 | CGFloat detailW = 160; 61 | CGFloat detailH = 16; 62 | CGFloat detailY = titleY; 63 | CGFloat detailX = CGRectGetMaxX(self.title.frame) + 10; 64 | self.detail.frame = CGRectMake(detailX, detailY, detailW, detailH); 65 | 66 | self.editBtn.centerY = self.title.centerY; 67 | self.editBtn.size = CGSizeMake(50, 24); 68 | self.editBtn.x = self.width - 60; 69 | } 70 | 71 | - (CGSize)returnTitleSize { 72 | CGSize size = [self.title.text boundingRectWithSize:CGSizeMake(self.width - 20, CGFLOAT_MAX) 73 | options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin 74 | attributes:@{NSFontAttributeName:self.title.font} 75 | context:nil].size; 76 | return size; 77 | } 78 | 79 | - (void)setTitleStr:(NSString *)titleStr { 80 | _titleStr = titleStr; 81 | self.title.text = titleStr; 82 | 83 | [self initFrame]; 84 | } 85 | 86 | - (void)setDetailStr:(NSString *)detailStr { 87 | _detailStr = detailStr; 88 | 89 | self.detail.text = detailStr; 90 | 91 | [self initFrame]; 92 | } 93 | 94 | @end 95 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMColumnMenuModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMColumnMenuModel.h 3 | // JMCollectionView 4 | // 5 | // Created by 刘俊敏 on 2017/12/8. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JMColumnMenu.h" 11 | 12 | @interface JMColumnMenuModel : NSObject 13 | 14 | /** title */ 15 | @property (nonatomic, copy) NSString *title; 16 | /** 是否选中 */ 17 | @property (nonatomic, assign) BOOL selected; 18 | /** 是否允许删除 */ 19 | @property (nonatomic, assign) BOOL resident; 20 | /** 是否显示加号 */ 21 | @property (nonatomic, assign) BOOL showAdd; 22 | /** type */ 23 | @property (nonatomic, assign) JMColumnMenuType type; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMColumnMenuModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMColumnMenuModel.m 3 | // JMCollectionView 4 | // 5 | // Created by 刘俊敏 on 2017/12/8. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import "JMColumnMenuModel.h" 10 | 11 | @implementation JMColumnMenuModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMConfig.h 3 | // JMCollectionView 4 | // 5 | // Created by 刘俊敏 on 2017/12/7. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface JMConfig : NSObject 13 | 14 | #define kRandomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0] 15 | 16 | //16进制颜色转换 17 | + (UIColor *)colorWithHexString:(NSString *)color; 18 | 19 | + (UIColor *)colorWithHexString:(NSString *)color Alpha:(CGFloat)alpha; 20 | 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/JMConfig.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMConfig.m 3 | // JMCollectionView 4 | // 5 | // Created by 刘俊敏 on 2017/12/7. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import "JMConfig.h" 10 | 11 | @implementation JMConfig 12 | 13 | + (UIColor *)colorWithHexString:(NSString *)color { 14 | return [self colorWithHexString:color Alpha:1.0f]; 15 | } 16 | 17 | + (UIColor *)colorWithHexString:(NSString *)color Alpha:(CGFloat)alpha { 18 | NSString *cString = [[color stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString]; 19 | if ([cString length] < 6) { 20 | return [UIColor clearColor]; 21 | } 22 | 23 | //判断前缀 24 | if ([cString hasPrefix:@"0X"]) { 25 | cString = [cString substringFromIndex:2]; 26 | } 27 | if ([cString hasPrefix:@"#"]) { 28 | cString = [cString substringFromIndex:1]; 29 | } 30 | if ([cString length] != 6) { 31 | return [UIColor clearColor]; 32 | } 33 | 34 | //从六位数值中找到RGB对应的位数并转换 35 | NSRange range; 36 | range.location = 0; 37 | range.length = 2; 38 | //R G B 39 | NSString *rString = [cString substringWithRange:range]; 40 | range.location = 2; 41 | NSString *gString = [cString substringWithRange:range]; 42 | range.location = 4; 43 | NSString *bString = [cString substringWithRange:range]; 44 | 45 | unsigned int r, g, b; 46 | [[NSScanner scannerWithString:rString] scanHexInt:&r]; 47 | [[NSScanner scannerWithString:gString] scanHexInt:&g]; 48 | [[NSScanner scannerWithString:bString] scanHexInt:&b]; 49 | 50 | return [UIColor colorWithRed:((float) r / 255.0f) green:((float) g / 255.0f) blue:((float) b / 255.0f) alpha:alpha]; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/UIView+JM.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+JM.h 3 | // tool 4 | // 5 | // Created by JM on 16/10/25. 6 | // Copyright © 2016年 JM. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (JM) 12 | @property (nonatomic, assign) CGFloat x; 13 | @property (nonatomic, assign) CGFloat y; 14 | @property (nonatomic, assign) CGFloat width; 15 | @property (nonatomic, assign) CGFloat height; 16 | @property (nonatomic, assign) CGFloat centerX; 17 | @property (nonatomic, assign) CGFloat centerY; 18 | @property (nonatomic, assign) CGSize size; 19 | @end 20 | -------------------------------------------------------------------------------- /JMColumnMenu/JMColumnMenu/UIView+JM.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+JM.m 3 | // tool 4 | // 5 | // Created by JM on 16/10/25. 6 | // Copyright © 2016年 JM. All rights reserved. 7 | // 8 | 9 | #import "UIView+JM.h" 10 | 11 | @implementation UIView (JM) 12 | - (void)setX:(CGFloat)x 13 | { 14 | CGRect frame = self.frame; 15 | frame.origin.x = x; 16 | self.frame = frame; 17 | } 18 | 19 | - (CGFloat)x 20 | { 21 | return self.frame.origin.x; 22 | } 23 | 24 | - (void)setY:(CGFloat)y 25 | { 26 | CGRect frame = self.frame; 27 | frame.origin.y = y; 28 | self.frame = frame; 29 | } 30 | 31 | - (CGFloat)y 32 | { 33 | return self.frame.origin.y; 34 | } 35 | 36 | - (void)setWidth:(CGFloat)width 37 | { 38 | CGRect frame = self.frame; 39 | frame.size.width = width; 40 | self.frame = frame; 41 | } 42 | 43 | - (CGFloat)width 44 | { 45 | return self.frame.size.width; 46 | } 47 | 48 | - (void)setHeight:(CGFloat)height 49 | { 50 | CGRect frame = self.frame; 51 | frame.size.height = height; 52 | self.frame = frame; 53 | } 54 | 55 | - (CGFloat)height 56 | { 57 | return self.frame.size.height; 58 | } 59 | 60 | - (void)setSize:(CGSize)size 61 | { 62 | CGRect frame = self.frame; 63 | frame.size = size; 64 | self.frame = frame; 65 | } 66 | 67 | - (CGSize)size 68 | { 69 | return self.frame.size; 70 | } 71 | 72 | - (void)setCenterX:(CGFloat)centerX 73 | { 74 | CGPoint center = self.center; 75 | center.x = centerX; 76 | self.center = center; 77 | } 78 | 79 | - (CGFloat)centerX 80 | { 81 | return self.center.x; 82 | } 83 | 84 | - (void)setCenterY:(CGFloat)centerY 85 | { 86 | CGPoint center = self.center; 87 | center.y = centerY; 88 | self.center = center; 89 | } 90 | 91 | - (CGFloat)centerY 92 | { 93 | return self.center.y; 94 | } 95 | @end 96 | -------------------------------------------------------------------------------- /JMColumnMenu/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // JMColumnMenu 4 | // 5 | // Created by JM on 2017/12/12. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /JMColumnMenu/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // JMColumnMenu 4 | // 5 | // Created by JM on 2017/12/12. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "JMColumnMenu.h" 11 | 12 | 13 | #import "UIView+JM.h" 14 | #import "JMConfig.h" 15 | 16 | @interface ViewController () 17 | 18 | /** menuView */ 19 | @property (nonatomic, strong) JMColumnMenu *menu; 20 | 21 | @end 22 | 23 | @implementation ViewController 24 | 25 | 26 | + (void)initialize { 27 | UINavigationBar *bar = [UINavigationBar appearance]; 28 | [bar setBarTintColor:[UIColor blackColor]]; 29 | [bar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}]; 30 | } 31 | 32 | - (void)viewDidLoad { 33 | [super viewDidLoad]; 34 | 35 | self.title = @"JM"; 36 | 37 | self.edgesForExtendedLayout = UIRectEdgeNone; 38 | 39 | NSArray *arr = @[@"仿腾讯新闻",@"仿今日头条"]; 40 | for (int i = 0; i < arr.count; i++) { 41 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; 42 | [btn setTitle:arr[i] forState:UIControlStateNormal]; 43 | btn.backgroundColor = kRandomColor; 44 | btn.titleLabel.font = [UIFont systemFontOfSize:15.f]; 45 | btn.centerX = self.view.width * 0.5 - 50; 46 | btn.width = 100; 47 | btn.height = 40; 48 | btn.y = i * 40 + 20 * (i + 1); 49 | btn.layer.cornerRadius = 4.f; 50 | btn.layer.masksToBounds = YES; 51 | btn.tag = i; 52 | [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside]; 53 | [self.view addSubview:btn]; 54 | } 55 | } 56 | 57 | - (void)btnClick:(UIButton *)btn { 58 | //初始化数据 59 | NSMutableArray *myTagsArrM = [NSMutableArray arrayWithObjects:@"要闻",@"视频",@"娱乐",@"军事",@"新时代",@"独家",@"广东",@"社会",@"图文",@"段子",@"搞笑视频", nil]; 60 | NSMutableArray *otherArrM = [NSMutableArray arrayWithObjects:@"八卦",@"搞笑",@"短视频",@"图文段子",@"极限第一人", nil]; 61 | 62 | if (btn.tag == 0) { //仿腾讯新闻 63 | JMColumnMenu *menuVC = [JMColumnMenu columnMenuWithTagsArrM:myTagsArrM OtherArrM:otherArrM Type:JMColumnMenuTypeTencent Delegate:self]; 64 | [self presentViewController:menuVC animated:YES completion:nil]; 65 | } else if (btn.tag == 1) { //仿今日头条 66 | JMColumnMenu *menuVC = [JMColumnMenu columnMenuWithTagsArrM:myTagsArrM OtherArrM:otherArrM Type:JMColumnMenuTypeTouTiao Delegate:self]; 67 | [self presentViewController:menuVC animated:YES completion:nil]; 68 | } 69 | } 70 | 71 | #pragma mark - JMColumnMenuDelegate 72 | - (void)columnMenuTagsArr:(NSMutableArray *)tagsArr OtherArr:(NSMutableArray *)otherArr { 73 | NSLog(@"选择数组---%@",tagsArr); 74 | NSLog(@"未选择数组%@",otherArr); 75 | } 76 | 77 | - (void)columnMenuDidSelectTitle:(NSString *)title Index:(NSInteger)index { 78 | NSLog(@"点击的标题---%@ 对应的index---%zd",title, index); 79 | } 80 | 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /JMColumnMenu/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JMColumnMenu 4 | // 5 | // Created by JM on 2017/12/12. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /JMColumnMenuTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /JMColumnMenuTests/JMColumnMenuTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMColumnMenuTests.m 3 | // JMColumnMenuTests 4 | // 5 | // Created by JM on 2017/12/12. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JMColumnMenuTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation JMColumnMenuTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /JMColumnMenuUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /JMColumnMenuUITests/JMColumnMenuUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JMColumnMenuUITests.m 3 | // JMColumnMenuUITests 4 | // 5 | // Created by JM on 2017/12/12. 6 | // Copyright © 2017年 ljm. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JMColumnMenuUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation JMColumnMenuUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 JunAILiang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JMColumnMenu 2 | 仿腾讯新闻、今日头条栏目管理 3 | 4 | # 如何使用 5 | * 可以通过CocoaPods导入 ``` pod 'JMColumnMenu', '~> 1.1.1' ``` 6 | * 或者直接下载工程把JMColumnMenu导入到您的项目中 7 | 8 | 9 | ## 初始化数据 10 | ``` 11 | NSMutableArray *myTagsArrM = [NSMutableArray arrayWithObjects:@"要闻",@"视频",@"娱乐",@"军事",@"新时代",@"独家",@"广东",@"社会",@"图文",@"段子",@"搞笑视频", nil]; 12 | NSMutableArray *otherArrM = [NSMutableArray arrayWithObjects:@"八卦",@"搞笑",@"短视频",@"图文段子",@"极限第一人", nil]; 13 | ``` 14 | 15 | ## 一行代码调用 16 | ``` 17 | JMColumnMenu *menuVC = [JMColumnMenu columnMenuWithTagsArrM:myTagsArrM OtherArrM:otherArrM Type:JMColumnMenuTypeTencent Delegate:self]; 18 | [self presentViewController:menuVC animated:YES completion:nil]; 19 | 20 | JMColumnMenu *menuVC1 = [[JMColumnMenu alloc] initWithTagsArrM:myTagsArrM OtherArrM:otherArrM Type:JMColumnMenuTypeTencent Delegate:self]; 21 | [self presentViewController:menuVC1 animated:YES completion:nil]; 22 | ``` 23 | ## 遵守代理 24 | ``` 25 | #pragma mark - JMColumnMenuDelegate 26 | - (void)columnMenuTagsArr:(NSMutableArray *)tagsArr OtherArr:(NSMutableArray *)otherArr { 27 | NSLog(@"选择数组---%@",tagsArr); 28 | NSLog(@"未选择数组%@",otherArr); 29 | } 30 | 31 | - (void)columnMenuDidSelectTitle:(NSString *)title Index:(NSInteger)index { 32 | NSLog(@"点击的标题---%@ 对应的index---%zd",title, index); 33 | } 34 | ``` 35 | 联系我:
36 | * qq: 1245424073 37 | [我的博客](https://ljmvip.cn) 38 | --------------------------------------------------------------------------------