├── LQFoldButton ├── LQFoldButton.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── LQiqiang.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── LQiqiang.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── LQFoldButton │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── LZFoldButton │ │ ├── LQFoldButton.h │ │ └── LQFoldButton.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── LQFoldButtonTests │ ├── Info.plist │ └── LQFoldButtonTests.m └── LQFoldButtonUITests │ ├── Info.plist │ └── LQFoldButtonUITests.m ├── README.md └── aaa.gif /LQFoldButton/LQFoldButton.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D277C931212FAE53003327DB /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D277C930212FAE53003327DB /* AppDelegate.m */; }; 11 | D277C934212FAE53003327DB /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D277C933212FAE53003327DB /* ViewController.m */; }; 12 | D277C937212FAE53003327DB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D277C935212FAE53003327DB /* Main.storyboard */; }; 13 | D277C939212FAE54003327DB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D277C938212FAE54003327DB /* Assets.xcassets */; }; 14 | D277C93C212FAE54003327DB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D277C93A212FAE54003327DB /* LaunchScreen.storyboard */; }; 15 | D277C93F212FAE54003327DB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D277C93E212FAE54003327DB /* main.m */; }; 16 | D277C949212FAE54003327DB /* LQFoldButtonTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D277C948212FAE54003327DB /* LQFoldButtonTests.m */; }; 17 | D277C954212FAE54003327DB /* LQFoldButtonUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = D277C953212FAE54003327DB /* LQFoldButtonUITests.m */; }; 18 | D277C964212FB0E0003327DB /* LQFoldButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D277C963212FB0E0003327DB /* LQFoldButton.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | D277C945212FAE54003327DB /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = D277C924212FAE53003327DB /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = D277C92B212FAE53003327DB; 27 | remoteInfo = LQFoldButton; 28 | }; 29 | D277C950212FAE54003327DB /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = D277C924212FAE53003327DB /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = D277C92B212FAE53003327DB; 34 | remoteInfo = LQFoldButton; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | D277C92C212FAE53003327DB /* LQFoldButton.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LQFoldButton.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | D277C92F212FAE53003327DB /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 41 | D277C930212FAE53003327DB /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 42 | D277C932212FAE53003327DB /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 43 | D277C933212FAE53003327DB /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 44 | D277C936212FAE53003327DB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | D277C938212FAE54003327DB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 46 | D277C93B212FAE54003327DB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 47 | D277C93D212FAE54003327DB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | D277C93E212FAE54003327DB /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 49 | D277C944212FAE54003327DB /* LQFoldButtonTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LQFoldButtonTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | D277C948212FAE54003327DB /* LQFoldButtonTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LQFoldButtonTests.m; sourceTree = ""; }; 51 | D277C94A212FAE54003327DB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | D277C94F212FAE54003327DB /* LQFoldButtonUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LQFoldButtonUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | D277C953212FAE54003327DB /* LQFoldButtonUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LQFoldButtonUITests.m; sourceTree = ""; }; 54 | D277C955212FAE54003327DB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | D277C962212FB0E0003327DB /* LQFoldButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LQFoldButton.h; sourceTree = ""; }; 56 | D277C963212FB0E0003327DB /* LQFoldButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LQFoldButton.m; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | D277C929212FAE53003327DB /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | D277C941212FAE54003327DB /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | D277C94C212FAE54003327DB /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | D277C923212FAE53003327DB = { 85 | isa = PBXGroup; 86 | children = ( 87 | D277C92E212FAE53003327DB /* LQFoldButton */, 88 | D277C947212FAE54003327DB /* LQFoldButtonTests */, 89 | D277C952212FAE54003327DB /* LQFoldButtonUITests */, 90 | D277C92D212FAE53003327DB /* Products */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | D277C92D212FAE53003327DB /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | D277C92C212FAE53003327DB /* LQFoldButton.app */, 98 | D277C944212FAE54003327DB /* LQFoldButtonTests.xctest */, 99 | D277C94F212FAE54003327DB /* LQFoldButtonUITests.xctest */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | D277C92E212FAE53003327DB /* LQFoldButton */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | D277C961212FAE5D003327DB /* LZFoldButton */, 108 | D277C92F212FAE53003327DB /* AppDelegate.h */, 109 | D277C930212FAE53003327DB /* AppDelegate.m */, 110 | D277C932212FAE53003327DB /* ViewController.h */, 111 | D277C933212FAE53003327DB /* ViewController.m */, 112 | D277C935212FAE53003327DB /* Main.storyboard */, 113 | D277C938212FAE54003327DB /* Assets.xcassets */, 114 | D277C93A212FAE54003327DB /* LaunchScreen.storyboard */, 115 | D277C93D212FAE54003327DB /* Info.plist */, 116 | D277C93E212FAE54003327DB /* main.m */, 117 | ); 118 | path = LQFoldButton; 119 | sourceTree = ""; 120 | }; 121 | D277C947212FAE54003327DB /* LQFoldButtonTests */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | D277C948212FAE54003327DB /* LQFoldButtonTests.m */, 125 | D277C94A212FAE54003327DB /* Info.plist */, 126 | ); 127 | path = LQFoldButtonTests; 128 | sourceTree = ""; 129 | }; 130 | D277C952212FAE54003327DB /* LQFoldButtonUITests */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | D277C953212FAE54003327DB /* LQFoldButtonUITests.m */, 134 | D277C955212FAE54003327DB /* Info.plist */, 135 | ); 136 | path = LQFoldButtonUITests; 137 | sourceTree = ""; 138 | }; 139 | D277C961212FAE5D003327DB /* LZFoldButton */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | D277C962212FB0E0003327DB /* LQFoldButton.h */, 143 | D277C963212FB0E0003327DB /* LQFoldButton.m */, 144 | ); 145 | path = LZFoldButton; 146 | sourceTree = ""; 147 | }; 148 | /* End PBXGroup section */ 149 | 150 | /* Begin PBXNativeTarget section */ 151 | D277C92B212FAE53003327DB /* LQFoldButton */ = { 152 | isa = PBXNativeTarget; 153 | buildConfigurationList = D277C958212FAE54003327DB /* Build configuration list for PBXNativeTarget "LQFoldButton" */; 154 | buildPhases = ( 155 | D277C928212FAE53003327DB /* Sources */, 156 | D277C929212FAE53003327DB /* Frameworks */, 157 | D277C92A212FAE53003327DB /* Resources */, 158 | ); 159 | buildRules = ( 160 | ); 161 | dependencies = ( 162 | ); 163 | name = LQFoldButton; 164 | productName = LQFoldButton; 165 | productReference = D277C92C212FAE53003327DB /* LQFoldButton.app */; 166 | productType = "com.apple.product-type.application"; 167 | }; 168 | D277C943212FAE54003327DB /* LQFoldButtonTests */ = { 169 | isa = PBXNativeTarget; 170 | buildConfigurationList = D277C95B212FAE54003327DB /* Build configuration list for PBXNativeTarget "LQFoldButtonTests" */; 171 | buildPhases = ( 172 | D277C940212FAE54003327DB /* Sources */, 173 | D277C941212FAE54003327DB /* Frameworks */, 174 | D277C942212FAE54003327DB /* Resources */, 175 | ); 176 | buildRules = ( 177 | ); 178 | dependencies = ( 179 | D277C946212FAE54003327DB /* PBXTargetDependency */, 180 | ); 181 | name = LQFoldButtonTests; 182 | productName = LQFoldButtonTests; 183 | productReference = D277C944212FAE54003327DB /* LQFoldButtonTests.xctest */; 184 | productType = "com.apple.product-type.bundle.unit-test"; 185 | }; 186 | D277C94E212FAE54003327DB /* LQFoldButtonUITests */ = { 187 | isa = PBXNativeTarget; 188 | buildConfigurationList = D277C95E212FAE54003327DB /* Build configuration list for PBXNativeTarget "LQFoldButtonUITests" */; 189 | buildPhases = ( 190 | D277C94B212FAE54003327DB /* Sources */, 191 | D277C94C212FAE54003327DB /* Frameworks */, 192 | D277C94D212FAE54003327DB /* Resources */, 193 | ); 194 | buildRules = ( 195 | ); 196 | dependencies = ( 197 | D277C951212FAE54003327DB /* PBXTargetDependency */, 198 | ); 199 | name = LQFoldButtonUITests; 200 | productName = LQFoldButtonUITests; 201 | productReference = D277C94F212FAE54003327DB /* LQFoldButtonUITests.xctest */; 202 | productType = "com.apple.product-type.bundle.ui-testing"; 203 | }; 204 | /* End PBXNativeTarget section */ 205 | 206 | /* Begin PBXProject section */ 207 | D277C924212FAE53003327DB /* Project object */ = { 208 | isa = PBXProject; 209 | attributes = { 210 | LastUpgradeCheck = 0940; 211 | ORGANIZATIONNAME = LiuQiqiang; 212 | TargetAttributes = { 213 | D277C92B212FAE53003327DB = { 214 | CreatedOnToolsVersion = 9.4.1; 215 | }; 216 | D277C943212FAE54003327DB = { 217 | CreatedOnToolsVersion = 9.4.1; 218 | TestTargetID = D277C92B212FAE53003327DB; 219 | }; 220 | D277C94E212FAE54003327DB = { 221 | CreatedOnToolsVersion = 9.4.1; 222 | TestTargetID = D277C92B212FAE53003327DB; 223 | }; 224 | }; 225 | }; 226 | buildConfigurationList = D277C927212FAE53003327DB /* Build configuration list for PBXProject "LQFoldButton" */; 227 | compatibilityVersion = "Xcode 9.3"; 228 | developmentRegion = en; 229 | hasScannedForEncodings = 0; 230 | knownRegions = ( 231 | en, 232 | Base, 233 | ); 234 | mainGroup = D277C923212FAE53003327DB; 235 | productRefGroup = D277C92D212FAE53003327DB /* Products */; 236 | projectDirPath = ""; 237 | projectRoot = ""; 238 | targets = ( 239 | D277C92B212FAE53003327DB /* LQFoldButton */, 240 | D277C943212FAE54003327DB /* LQFoldButtonTests */, 241 | D277C94E212FAE54003327DB /* LQFoldButtonUITests */, 242 | ); 243 | }; 244 | /* End PBXProject section */ 245 | 246 | /* Begin PBXResourcesBuildPhase section */ 247 | D277C92A212FAE53003327DB /* Resources */ = { 248 | isa = PBXResourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | D277C93C212FAE54003327DB /* LaunchScreen.storyboard in Resources */, 252 | D277C939212FAE54003327DB /* Assets.xcassets in Resources */, 253 | D277C937212FAE53003327DB /* Main.storyboard in Resources */, 254 | ); 255 | runOnlyForDeploymentPostprocessing = 0; 256 | }; 257 | D277C942212FAE54003327DB /* Resources */ = { 258 | isa = PBXResourcesBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | D277C94D212FAE54003327DB /* Resources */ = { 265 | isa = PBXResourcesBuildPhase; 266 | buildActionMask = 2147483647; 267 | files = ( 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | /* End PBXResourcesBuildPhase section */ 272 | 273 | /* Begin PBXSourcesBuildPhase section */ 274 | D277C928212FAE53003327DB /* Sources */ = { 275 | isa = PBXSourcesBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | D277C934212FAE53003327DB /* ViewController.m in Sources */, 279 | D277C93F212FAE54003327DB /* main.m in Sources */, 280 | D277C931212FAE53003327DB /* AppDelegate.m in Sources */, 281 | D277C964212FB0E0003327DB /* LQFoldButton.m in Sources */, 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | }; 285 | D277C940212FAE54003327DB /* Sources */ = { 286 | isa = PBXSourcesBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | D277C949212FAE54003327DB /* LQFoldButtonTests.m in Sources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | D277C94B212FAE54003327DB /* Sources */ = { 294 | isa = PBXSourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | D277C954212FAE54003327DB /* LQFoldButtonUITests.m in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | /* End PBXSourcesBuildPhase section */ 302 | 303 | /* Begin PBXTargetDependency section */ 304 | D277C946212FAE54003327DB /* PBXTargetDependency */ = { 305 | isa = PBXTargetDependency; 306 | target = D277C92B212FAE53003327DB /* LQFoldButton */; 307 | targetProxy = D277C945212FAE54003327DB /* PBXContainerItemProxy */; 308 | }; 309 | D277C951212FAE54003327DB /* PBXTargetDependency */ = { 310 | isa = PBXTargetDependency; 311 | target = D277C92B212FAE53003327DB /* LQFoldButton */; 312 | targetProxy = D277C950212FAE54003327DB /* PBXContainerItemProxy */; 313 | }; 314 | /* End PBXTargetDependency section */ 315 | 316 | /* Begin PBXVariantGroup section */ 317 | D277C935212FAE53003327DB /* Main.storyboard */ = { 318 | isa = PBXVariantGroup; 319 | children = ( 320 | D277C936212FAE53003327DB /* Base */, 321 | ); 322 | name = Main.storyboard; 323 | sourceTree = ""; 324 | }; 325 | D277C93A212FAE54003327DB /* LaunchScreen.storyboard */ = { 326 | isa = PBXVariantGroup; 327 | children = ( 328 | D277C93B212FAE54003327DB /* Base */, 329 | ); 330 | name = LaunchScreen.storyboard; 331 | sourceTree = ""; 332 | }; 333 | /* End PBXVariantGroup section */ 334 | 335 | /* Begin XCBuildConfiguration section */ 336 | D277C956212FAE54003327DB /* Debug */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | ALWAYS_SEARCH_USER_PATHS = NO; 340 | CLANG_ANALYZER_NONNULL = YES; 341 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 343 | CLANG_CXX_LIBRARY = "libc++"; 344 | CLANG_ENABLE_MODULES = YES; 345 | CLANG_ENABLE_OBJC_ARC = YES; 346 | CLANG_ENABLE_OBJC_WEAK = YES; 347 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 348 | CLANG_WARN_BOOL_CONVERSION = YES; 349 | CLANG_WARN_COMMA = YES; 350 | CLANG_WARN_CONSTANT_CONVERSION = YES; 351 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 352 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 353 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 354 | CLANG_WARN_EMPTY_BODY = YES; 355 | CLANG_WARN_ENUM_CONVERSION = YES; 356 | CLANG_WARN_INFINITE_RECURSION = YES; 357 | CLANG_WARN_INT_CONVERSION = YES; 358 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 359 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 360 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 361 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 362 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 363 | CLANG_WARN_STRICT_PROTOTYPES = YES; 364 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 365 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 366 | CLANG_WARN_UNREACHABLE_CODE = YES; 367 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 368 | CODE_SIGN_IDENTITY = "iPhone Developer"; 369 | COPY_PHASE_STRIP = NO; 370 | DEBUG_INFORMATION_FORMAT = dwarf; 371 | ENABLE_STRICT_OBJC_MSGSEND = YES; 372 | ENABLE_TESTABILITY = YES; 373 | GCC_C_LANGUAGE_STANDARD = gnu11; 374 | GCC_DYNAMIC_NO_PIC = NO; 375 | GCC_NO_COMMON_BLOCKS = YES; 376 | GCC_OPTIMIZATION_LEVEL = 0; 377 | GCC_PREPROCESSOR_DEFINITIONS = ( 378 | "DEBUG=1", 379 | "$(inherited)", 380 | ); 381 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 382 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 383 | GCC_WARN_UNDECLARED_SELECTOR = YES; 384 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 385 | GCC_WARN_UNUSED_FUNCTION = YES; 386 | GCC_WARN_UNUSED_VARIABLE = YES; 387 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 388 | MTL_ENABLE_DEBUG_INFO = YES; 389 | ONLY_ACTIVE_ARCH = YES; 390 | SDKROOT = iphoneos; 391 | }; 392 | name = Debug; 393 | }; 394 | D277C957212FAE54003327DB /* Release */ = { 395 | isa = XCBuildConfiguration; 396 | buildSettings = { 397 | ALWAYS_SEARCH_USER_PATHS = NO; 398 | CLANG_ANALYZER_NONNULL = YES; 399 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 400 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 401 | CLANG_CXX_LIBRARY = "libc++"; 402 | CLANG_ENABLE_MODULES = YES; 403 | CLANG_ENABLE_OBJC_ARC = YES; 404 | CLANG_ENABLE_OBJC_WEAK = YES; 405 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 406 | CLANG_WARN_BOOL_CONVERSION = YES; 407 | CLANG_WARN_COMMA = YES; 408 | CLANG_WARN_CONSTANT_CONVERSION = YES; 409 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 410 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 411 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 412 | CLANG_WARN_EMPTY_BODY = YES; 413 | CLANG_WARN_ENUM_CONVERSION = YES; 414 | CLANG_WARN_INFINITE_RECURSION = YES; 415 | CLANG_WARN_INT_CONVERSION = YES; 416 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 417 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 418 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 419 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 420 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 421 | CLANG_WARN_STRICT_PROTOTYPES = YES; 422 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 423 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 424 | CLANG_WARN_UNREACHABLE_CODE = YES; 425 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 426 | CODE_SIGN_IDENTITY = "iPhone Developer"; 427 | COPY_PHASE_STRIP = NO; 428 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 429 | ENABLE_NS_ASSERTIONS = NO; 430 | ENABLE_STRICT_OBJC_MSGSEND = YES; 431 | GCC_C_LANGUAGE_STANDARD = gnu11; 432 | GCC_NO_COMMON_BLOCKS = YES; 433 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 434 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 435 | GCC_WARN_UNDECLARED_SELECTOR = YES; 436 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 437 | GCC_WARN_UNUSED_FUNCTION = YES; 438 | GCC_WARN_UNUSED_VARIABLE = YES; 439 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 440 | MTL_ENABLE_DEBUG_INFO = NO; 441 | SDKROOT = iphoneos; 442 | VALIDATE_PRODUCT = YES; 443 | }; 444 | name = Release; 445 | }; 446 | D277C959212FAE54003327DB /* Debug */ = { 447 | isa = XCBuildConfiguration; 448 | buildSettings = { 449 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 450 | CODE_SIGN_STYLE = Automatic; 451 | DEVELOPMENT_TEAM = M5AQP3WXJE; 452 | INFOPLIST_FILE = LQFoldButton/Info.plist; 453 | LD_RUNPATH_SEARCH_PATHS = ( 454 | "$(inherited)", 455 | "@executable_path/Frameworks", 456 | ); 457 | PRODUCT_BUNDLE_IDENTIFIER = com.ldshare.LQFoldButton; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | TARGETED_DEVICE_FAMILY = "1,2"; 460 | }; 461 | name = Debug; 462 | }; 463 | D277C95A212FAE54003327DB /* Release */ = { 464 | isa = XCBuildConfiguration; 465 | buildSettings = { 466 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 467 | CODE_SIGN_STYLE = Automatic; 468 | DEVELOPMENT_TEAM = M5AQP3WXJE; 469 | INFOPLIST_FILE = LQFoldButton/Info.plist; 470 | LD_RUNPATH_SEARCH_PATHS = ( 471 | "$(inherited)", 472 | "@executable_path/Frameworks", 473 | ); 474 | PRODUCT_BUNDLE_IDENTIFIER = com.ldshare.LQFoldButton; 475 | PRODUCT_NAME = "$(TARGET_NAME)"; 476 | TARGETED_DEVICE_FAMILY = "1,2"; 477 | }; 478 | name = Release; 479 | }; 480 | D277C95C212FAE54003327DB /* Debug */ = { 481 | isa = XCBuildConfiguration; 482 | buildSettings = { 483 | BUNDLE_LOADER = "$(TEST_HOST)"; 484 | CODE_SIGN_STYLE = Automatic; 485 | DEVELOPMENT_TEAM = M5AQP3WXJE; 486 | INFOPLIST_FILE = LQFoldButtonTests/Info.plist; 487 | LD_RUNPATH_SEARCH_PATHS = ( 488 | "$(inherited)", 489 | "@executable_path/Frameworks", 490 | "@loader_path/Frameworks", 491 | ); 492 | PRODUCT_BUNDLE_IDENTIFIER = com.ldshare.LQFoldButtonTests; 493 | PRODUCT_NAME = "$(TARGET_NAME)"; 494 | TARGETED_DEVICE_FAMILY = "1,2"; 495 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LQFoldButton.app/LQFoldButton"; 496 | }; 497 | name = Debug; 498 | }; 499 | D277C95D212FAE54003327DB /* Release */ = { 500 | isa = XCBuildConfiguration; 501 | buildSettings = { 502 | BUNDLE_LOADER = "$(TEST_HOST)"; 503 | CODE_SIGN_STYLE = Automatic; 504 | DEVELOPMENT_TEAM = M5AQP3WXJE; 505 | INFOPLIST_FILE = LQFoldButtonTests/Info.plist; 506 | LD_RUNPATH_SEARCH_PATHS = ( 507 | "$(inherited)", 508 | "@executable_path/Frameworks", 509 | "@loader_path/Frameworks", 510 | ); 511 | PRODUCT_BUNDLE_IDENTIFIER = com.ldshare.LQFoldButtonTests; 512 | PRODUCT_NAME = "$(TARGET_NAME)"; 513 | TARGETED_DEVICE_FAMILY = "1,2"; 514 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LQFoldButton.app/LQFoldButton"; 515 | }; 516 | name = Release; 517 | }; 518 | D277C95F212FAE54003327DB /* Debug */ = { 519 | isa = XCBuildConfiguration; 520 | buildSettings = { 521 | CODE_SIGN_STYLE = Automatic; 522 | DEVELOPMENT_TEAM = M5AQP3WXJE; 523 | INFOPLIST_FILE = LQFoldButtonUITests/Info.plist; 524 | LD_RUNPATH_SEARCH_PATHS = ( 525 | "$(inherited)", 526 | "@executable_path/Frameworks", 527 | "@loader_path/Frameworks", 528 | ); 529 | PRODUCT_BUNDLE_IDENTIFIER = com.ldshare.LQFoldButtonUITests; 530 | PRODUCT_NAME = "$(TARGET_NAME)"; 531 | TARGETED_DEVICE_FAMILY = "1,2"; 532 | TEST_TARGET_NAME = LQFoldButton; 533 | }; 534 | name = Debug; 535 | }; 536 | D277C960212FAE54003327DB /* Release */ = { 537 | isa = XCBuildConfiguration; 538 | buildSettings = { 539 | CODE_SIGN_STYLE = Automatic; 540 | DEVELOPMENT_TEAM = M5AQP3WXJE; 541 | INFOPLIST_FILE = LQFoldButtonUITests/Info.plist; 542 | LD_RUNPATH_SEARCH_PATHS = ( 543 | "$(inherited)", 544 | "@executable_path/Frameworks", 545 | "@loader_path/Frameworks", 546 | ); 547 | PRODUCT_BUNDLE_IDENTIFIER = com.ldshare.LQFoldButtonUITests; 548 | PRODUCT_NAME = "$(TARGET_NAME)"; 549 | TARGETED_DEVICE_FAMILY = "1,2"; 550 | TEST_TARGET_NAME = LQFoldButton; 551 | }; 552 | name = Release; 553 | }; 554 | /* End XCBuildConfiguration section */ 555 | 556 | /* Begin XCConfigurationList section */ 557 | D277C927212FAE53003327DB /* Build configuration list for PBXProject "LQFoldButton" */ = { 558 | isa = XCConfigurationList; 559 | buildConfigurations = ( 560 | D277C956212FAE54003327DB /* Debug */, 561 | D277C957212FAE54003327DB /* Release */, 562 | ); 563 | defaultConfigurationIsVisible = 0; 564 | defaultConfigurationName = Release; 565 | }; 566 | D277C958212FAE54003327DB /* Build configuration list for PBXNativeTarget "LQFoldButton" */ = { 567 | isa = XCConfigurationList; 568 | buildConfigurations = ( 569 | D277C959212FAE54003327DB /* Debug */, 570 | D277C95A212FAE54003327DB /* Release */, 571 | ); 572 | defaultConfigurationIsVisible = 0; 573 | defaultConfigurationName = Release; 574 | }; 575 | D277C95B212FAE54003327DB /* Build configuration list for PBXNativeTarget "LQFoldButtonTests" */ = { 576 | isa = XCConfigurationList; 577 | buildConfigurations = ( 578 | D277C95C212FAE54003327DB /* Debug */, 579 | D277C95D212FAE54003327DB /* Release */, 580 | ); 581 | defaultConfigurationIsVisible = 0; 582 | defaultConfigurationName = Release; 583 | }; 584 | D277C95E212FAE54003327DB /* Build configuration list for PBXNativeTarget "LQFoldButtonUITests" */ = { 585 | isa = XCConfigurationList; 586 | buildConfigurations = ( 587 | D277C95F212FAE54003327DB /* Debug */, 588 | D277C960212FAE54003327DB /* Release */, 589 | ); 590 | defaultConfigurationIsVisible = 0; 591 | defaultConfigurationName = Release; 592 | }; 593 | /* End XCConfigurationList section */ 594 | }; 595 | rootObject = D277C924212FAE53003327DB /* Project object */; 596 | } 597 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton.xcodeproj/project.xcworkspace/xcuserdata/LQiqiang.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qrices/LQFoldButton/091f91ee6e36a6db08ecde75db24a7caf4fd0acd/LQFoldButton/LQFoldButton.xcodeproj/project.xcworkspace/xcuserdata/LQiqiang.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton.xcodeproj/xcuserdata/LQiqiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton.xcodeproj/xcuserdata/LQiqiang.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LQFoldButton.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | LQFoldButton.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LQFoldButton 4 | // 5 | // Created by LiuQiqiang on 2018/8/24. 6 | // Copyright © 2018年 LiuQiqiang. 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 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LQFoldButton 4 | // 5 | // Created by LiuQiqiang on 2018/8/24. 6 | // Copyright © 2018年 LiuQiqiang. 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 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton/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 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton/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 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton/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 | 45 | 46 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton/LZFoldButton/LQFoldButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // LQFoldButton.h 3 | // LQFoldButton 4 | // 5 | // Created by LiuQiqiang on 2018/8/24. 6 | // Copyright © 2018年 LiuQiqiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //按钮的样式,图片在左侧和在右侧两种 12 | typedef NS_ENUM(NSInteger,LQFoldButtonType) { 13 | LQFoldButtonTypeNormal = 0,// 14 | LQFoldButtonTypeImageRight = 1,//图片在右, title 在左 15 | }; 16 | 17 | @class LQFoldButtonItem; 18 | 19 | /** 20 | 选中的回调 Block 21 | 22 | @param obj 选中的元素 23 | @param index 选中的索引 24 | */ 25 | typedef void(^LQFoldButtonDidSelectedHandler)(LQFoldButtonItem *obj, NSInteger index); 26 | @interface LQFoldButton : UIView 27 | 28 | /** 29 | 展开视图的高度 30 | */ 31 | @property (nonatomic, assign) CGFloat contentHeight; 32 | 33 | /** 34 | 每个选择项的高度 35 | */ 36 | @property (nonatomic, assign) CGFloat itemHeight; 37 | 38 | /** 39 | 按钮的类型 40 | */ 41 | @property (nonatomic, assign) LQFoldButtonType type; 42 | 43 | /** 44 | 内容文本的属性 45 | */ 46 | @property (nonatomic, strong)NSDictionary *textAttribute; 47 | 48 | /** 49 | 当前选中的索引, 按钮 title 会默认显示对应item的title 50 | */ 51 | @property (nonatomic, assign) NSInteger selectedIndex ; 52 | 53 | /** 54 | 配置需要展示的数据源 55 | 56 | @param datas 数据源 57 | */ 58 | - (void) configDatas:(NSArray *) datas ; 59 | 60 | /** 61 | 选中方法回调 62 | 63 | @param handler 回调 Block 64 | */ 65 | - (void) didSelectedWithHandler:(LQFoldButtonDidSelectedHandler) handler ; 66 | 67 | /** 设置按钮的标题 */ 68 | - (void) setTitle:(NSString*)title forState:(UIControlState)state; 69 | /** 设置按钮的标题颜色 */ 70 | -(void) setTitleColor:(UIColor*)color forState:(UIControlState)state ; 71 | - (void) setAttributedTitle:(NSAttributedString*)title forState:(UIControlState)state; 72 | /** 设置按钮的背景图片 */ 73 | - (void) setBackgroundImage:(UIImage *)image forState:(UIControlState)state; 74 | /** 设置按钮的图片 */ 75 | - (void) setImage:(UIImage *)image forState:(UIControlState)state; 76 | @end 77 | 78 | #pragma mark - LQFoldButtonCell 79 | @interface LQFoldButtonCell : UITableViewCell 80 | 81 | @property (nonatomic, strong) LQFoldButtonItem *item; 82 | @property (nonatomic, copy) NSDictionary *textAttribute; 83 | @end 84 | 85 | #pragma mark - LQFoldButtonItem 86 | @interface LQFoldButtonItem : NSObject 87 | 88 | @property (nonatomic,copy) NSString *title; 89 | @end 90 | 91 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton/LZFoldButton/LQFoldButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // LQFoldButton.m 3 | // LQFoldButton 4 | // 5 | // Created by LiuQiqiang on 2018/8/24. 6 | // Copyright © 2018年 LiuQiqiang. All rights reserved. 7 | // 8 | 9 | #import "LQFoldButton.h" 10 | //#import "LQFoldButtonCell.h" 11 | //#import "LQFoldButtonItem.h" 12 | 13 | @interface LQFoldButton () 14 | { 15 | CGSize __foldContentSize; 16 | BOOL __isFolded; 17 | CGRect __originRect; 18 | } 19 | 20 | @property (nonatomic, strong) NSMutableArray *dataSource; 21 | @property (nonatomic, strong) UITableView *foldTable; 22 | @property (nonatomic, strong) UIButton *foldButton; 23 | @property (nonatomic, copy) LQFoldButtonDidSelectedHandler selectedHandler; 24 | @end 25 | 26 | @implementation LQFoldButton 27 | 28 | - (instancetype)initWithFrame:(CGRect)frame 29 | { 30 | self = [super initWithFrame:frame]; 31 | if (self) { 32 | _contentHeight = 200.0; 33 | _itemHeight = 44.0; 34 | __originRect = frame; 35 | _selectedIndex = -1; 36 | _textAttribute = @{NSFontAttributeName: [UIFont systemFontOfSize:12], NSForegroundColorAttributeName: [UIColor blueColor]}; 37 | } 38 | return self; 39 | } 40 | 41 | - (void) configDatas:(NSArray *) datas { 42 | if (self.dataSource.count > 0) { 43 | [self.dataSource removeAllObjects]; 44 | } 45 | 46 | [self.dataSource addObjectsFromArray:datas]; 47 | [self.foldTable reloadData]; 48 | 49 | if (_selectedIndex > -1 && _selectedIndex < datas.count) { 50 | 51 | LQFoldButtonItem *item = [datas objectAtIndex:_selectedIndex]; 52 | [self.foldButton setTitle:item.title forState:(UIControlStateNormal)]; 53 | } else { 54 | [self.foldButton setTitle:@"请选择" forState:(UIControlStateNormal)]; 55 | } 56 | } 57 | 58 | - (void) didSelectedWithHandler:(LQFoldButtonDidSelectedHandler) handler { 59 | self.selectedHandler = handler; 60 | } 61 | 62 | - (NSMutableArray *)dataSource { 63 | if (_dataSource == nil) { 64 | _dataSource = [NSMutableArray array]; 65 | } 66 | 67 | return _dataSource; 68 | } 69 | 70 | - (UITableView *)foldTable { 71 | if (_foldTable == nil) { 72 | _foldTable = [[UITableView alloc]initWithFrame:CGRectZero style:(UITableViewStylePlain)]; 73 | 74 | _foldTable.delegate = self; 75 | _foldTable.dataSource = self; 76 | _foldTable.backgroundColor = [UIColor whiteColor]; 77 | [self addSubview:_foldTable]; 78 | } 79 | 80 | return _foldTable; 81 | } 82 | 83 | - (UIButton *)foldButton { 84 | if (_foldButton == nil) { 85 | _foldButton = [UIButton buttonWithType:(UIButtonTypeCustom)]; 86 | _foldButton.backgroundColor = [UIColor blueColor]; 87 | // _foldButton.titleLabel.attributedText 88 | [_foldButton addTarget:self action:@selector(foldButtonAction:) forControlEvents:(UIControlEventTouchUpInside)]; 89 | [self addSubview:_foldButton]; 90 | } 91 | 92 | return _foldButton; 93 | } 94 | 95 | - (void) foldButtonAction:(UIButton *) button { 96 | //保证在父视图的最前面,不被其他视图遮挡 97 | if (self.superview != nil) { 98 | if ([self.superview.subviews lastObject] != self) { 99 | [self.superview bringSubviewToFront:self]; 100 | } 101 | } 102 | 103 | button.selected = !button.selected; 104 | if (__isFolded) { 105 | [self close]; 106 | } else { 107 | [self open]; 108 | } 109 | } 110 | 111 | - (void) close { 112 | //如果已经关闭了,直接返回 113 | if (__isFolded == NO) { 114 | return; 115 | } 116 | __isFolded = NO; 117 | 118 | CGRect rect = self.frame; 119 | rect.size.height -= self.contentHeight; 120 | self.frame = rect; 121 | } 122 | 123 | - (void) open { 124 | //如果已经展开了,直接返回 125 | if (__isFolded == YES) { 126 | return; 127 | } 128 | __isFolded = YES; 129 | CGRect rect = self.frame; 130 | rect.size.height += self.contentHeight; 131 | 132 | [UIView animateWithDuration:0.1 animations:^{ 133 | 134 | self.frame = rect; 135 | } completion:^(BOOL finished) { 136 | 137 | }]; 138 | } 139 | 140 | - (void)layoutSubviews { 141 | [super layoutSubviews]; 142 | 143 | if (__isFolded == NO) { 144 | __originRect = self.bounds; 145 | self.foldButton.frame = self.bounds; 146 | self.foldTable.frame = CGRectMake(0, CGRectGetHeight(self.bounds), CGRectGetWidth(self.bounds), 0); 147 | } else { 148 | 149 | [UIView animateWithDuration:0.1 animations:^{ 150 | self.foldTable.frame = CGRectMake(0, CGRectGetMaxY(self.foldButton.frame), CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds) - CGRectGetHeight(self.foldButton.frame)); } completion:^(BOOL finished) { 151 | 152 | }]; 153 | self.foldButton.frame = CGRectMake(0, 0, CGRectGetWidth(self.bounds), CGRectGetHeight(__originRect)); 154 | 155 | } 156 | } 157 | 158 | #pragma mark - UITableView 代理及数据源方法 159 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 160 | return self.dataSource.count; 161 | } 162 | 163 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 164 | LQFoldButtonCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([LQFoldButtonCell class])]; 165 | if (cell == nil) { 166 | cell = [[LQFoldButtonCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:NSStringFromClass([LQFoldButtonCell class])]; 167 | cell.backgroundColor = tableView.backgroundColor; 168 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 169 | 170 | cell.textAttribute = self.textAttribute; 171 | } 172 | 173 | cell.item = [self.dataSource objectAtIndex:indexPath.row]; 174 | 175 | return cell; 176 | } 177 | 178 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 179 | return self.itemHeight; 180 | } 181 | 182 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 183 | 184 | self.selectedIndex = indexPath.row; 185 | LQFoldButtonItem * obj = [self.dataSource objectAtIndex:indexPath.row]; 186 | 187 | if (self.selectedHandler) { 188 | self.selectedHandler(obj, indexPath.row); 189 | } 190 | 191 | [self foldButtonAction:self.foldButton]; 192 | [self setTitle:obj.title forState:(UIControlStateNormal)]; 193 | } 194 | 195 | - (void)setType:(LQFoldButtonType)type { 196 | _type = type; 197 | 198 | if (type == LQFoldButtonTypeImageRight) { 199 | 200 | [self.foldButton layoutIfNeeded]; 201 | 202 | CGSize titleSize = self.foldButton.titleLabel.bounds.size; 203 | CGSize imageSize = self.foldButton.imageView.bounds.size; 204 | CGFloat interval = 1.0; 205 | 206 | [self.foldButton setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter]; 207 | [self.foldButton setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter]; 208 | 209 | [self.foldButton setImageEdgeInsets:UIEdgeInsetsMake(0,titleSize.width + interval, 0, -(titleSize.width + interval))]; 210 | [self.foldButton setTitleEdgeInsets:UIEdgeInsetsMake(0, -(imageSize.width + interval), 0, imageSize.width + interval)]; 211 | } 212 | } 213 | 214 | /** 设置按钮的标题 */ 215 | - (void) setTitle:(NSString*)title forState:(UIControlState)state { 216 | [self.foldButton setTitle:title forState:state]; 217 | } 218 | 219 | - (void) setAttributedTitle:(NSAttributedString*)title forState:(UIControlState)state { 220 | [self.foldButton setAttributedTitle:title forState:state]; 221 | } 222 | /** 设置按钮的标题颜色 */ 223 | -(void) setTitleColor:(UIColor*)color forState:(UIControlState)state { 224 | [self.foldButton setTitleColor:color forState:state]; 225 | } 226 | /** 设置按钮的背景图片 */ 227 | - (void) setBackgroundImage:(UIImage *)image forState:(UIControlState)state { 228 | [self.foldButton setBackgroundImage:image forState:state]; 229 | } 230 | /** 设置按钮的图片 */ 231 | - (void) setImage:(UIImage *)image forState:(UIControlState)state { 232 | [self.foldButton setImage:image forState:state]; 233 | } 234 | /* 235 | // Only override drawRect: if you perform custom drawing. 236 | // An empty implementation adversely affects performance during animation. 237 | - (void)drawRect:(CGRect)rect { 238 | // Drawing code 239 | } 240 | */ 241 | 242 | @end 243 | 244 | #pragma mark - LQFoldButtonCell 245 | 246 | @implementation LQFoldButtonCell 247 | 248 | - (void)awakeFromNib { 249 | [super awakeFromNib]; 250 | // Initialization code 251 | } 252 | 253 | - (void)setItem:(LQFoldButtonItem *)item { 254 | _item = item; 255 | if (self.textAttribute) { 256 | NSAttributedString *attStr = [[NSAttributedString alloc]initWithString:item.title attributes:self.textAttribute]; 257 | self.textLabel.attributedText = attStr; 258 | } else { 259 | self.textLabel.text = item.title; 260 | } 261 | 262 | } 263 | 264 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 265 | [super setSelected:selected animated:animated]; 266 | 267 | // Configure the view for the selected state 268 | } 269 | 270 | @end 271 | 272 | #pragma mark - LQFoldButtonItem 273 | @implementation LQFoldButtonItem 274 | 275 | @end 276 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LQFoldButton 4 | // 5 | // Created by LiuQiqiang on 2018/8/24. 6 | // Copyright © 2018年 LiuQiqiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LQFoldButton 4 | // 5 | // Created by LiuQiqiang on 2018/8/24. 6 | // Copyright © 2018年 LiuQiqiang. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "LZFoldButton/LQFoldButton.h" 11 | //#import "LZFoldButton/LQFoldButtonItem.h" 12 | 13 | 14 | @interface ViewController () 15 | 16 | @property (nonatomic, strong) LQFoldButton *foldButton; 17 | @end 18 | 19 | @implementation ViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | // Do any additional setup after loading the view, typically from a nib. 24 | 25 | NSArray *arr = @[@"测试1",@"测试2",@"测试3",@"测试4",@"测试5",@"测试6",@"测试7",@"测试8"]; 26 | 27 | NSMutableArray *datas = [NSMutableArray arrayWithCapacity:arr.count]; 28 | for (NSString *title in arr) { 29 | LQFoldButtonItem *item = [[LQFoldButtonItem alloc]init]; 30 | item.title = title; 31 | [datas addObject:item]; 32 | } 33 | 34 | _foldButton = [[LQFoldButton alloc]init]; 35 | _foldButton.backgroundColor = [UIColor redColor]; 36 | _foldButton.frame = CGRectMake(100, 50, 100, 30); 37 | 38 | [_foldButton configDatas:datas]; 39 | 40 | [self.view addSubview:_foldButton]; 41 | } 42 | 43 | 44 | - (void)didReceiveMemoryWarning { 45 | [super didReceiveMemoryWarning]; 46 | // Dispose of any resources that can be recreated. 47 | } 48 | 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButton/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LQFoldButton 4 | // 5 | // Created by LiuQiqiang on 2018/8/24. 6 | // Copyright © 2018年 LiuQiqiang. 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 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButtonTests/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 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButtonTests/LQFoldButtonTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LQFoldButtonTests.m 3 | // LQFoldButtonTests 4 | // 5 | // Created by LiuQiqiang on 2018/8/24. 6 | // Copyright © 2018年 LiuQiqiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LQFoldButtonTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LQFoldButtonTests 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 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButtonUITests/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 | -------------------------------------------------------------------------------- /LQFoldButton/LQFoldButtonUITests/LQFoldButtonUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LQFoldButtonUITests.m 3 | // LQFoldButtonUITests 4 | // 5 | // Created by LiuQiqiang on 2018/8/24. 6 | // Copyright © 2018年 LiuQiqiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LQFoldButtonUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LQFoldButtonUITests 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 1.LQFoldButton 2 | 一个自定义的实现点击按钮,展现一个下拉列表的控件 3 | 4 | # 2.效果图 5 | ![效果图](https://github.com/LQQZYY/LZFoldButton/blob/master/aaa.gif) 6 | 7 | # 3.介绍 8 | LQFoldButton是将UIButton,UITableView和一些其他控件进行封装,并提供外部调用接口,将展示列表数据,选择列表数据等相关逻辑,都在其内部实现,外部只需要使用一个数据源数组初始化,设置相关属性即可; 9 | 10 | 属性不多, 可直接查看源码 11 | 12 | # 4. 使用 13 | 14 | ``` 15 | NSArray *arr = @[@"测试1",@"测试2",@"测试3",@"测试4",@"测试5",@"测试6",@"测试7",@"测试8"]; 16 | 17 | NSMutableArray *datas = [NSMutableArray arrayWithCapacity:arr.count]; 18 | for (NSString *title in arr) { 19 | LQFoldButtonItem *item = [[LQFoldButtonItem alloc]init]; 20 | item.title = title; 21 | [datas addObject:item]; 22 | } 23 | 24 | _foldButton = [[LQFoldButton alloc]init]; 25 | _foldButton.backgroundColor = [UIColor redColor]; 26 | _foldButton.frame = CGRectMake(100, 50, 100, 30); 27 | 28 | [_foldButton configDatas:datas]; 29 | 30 | [self.view addSubview:_foldButton]; 31 | 32 | ``` 33 | 34 | ##如果对你有帮助,请给颗星支持一下 35 | ##如果在使用中有bug,请反馈给我 36 | [个人博客](http://blog.csdn.net/lqq200912408) 37 | QQ号:302934443 38 | #(完) 39 | -------------------------------------------------------------------------------- /aaa.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qrices/LQFoldButton/091f91ee6e36a6db08ecde75db24a7caf4fd0acd/aaa.gif --------------------------------------------------------------------------------