├── .gitignore ├── DWQSelectAttributes.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── DWQSelectAttributes ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── DWQExtension │ ├── UIView+DWQExtension.h │ └── UIView+DWQExtension.m ├── DWQSelectAttributesView │ ├── DWQ-LOGO.jpeg │ ├── DWQSelectAttributes.h │ ├── DWQSelectAttributes.m │ ├── DWQSelectView.h │ ├── DWQSelectView.m │ ├── 凯迪拉克.jpg │ └── 取消.png ├── Info.plist ├── PrefixHeader.pch ├── ViewController.h ├── ViewController.m └── main.m ├── DWQSelectAttributesTests ├── DWQSelectAttributesTests.m └── Info.plist ├── DWQSelectAttributesUITests ├── DWQSelectAttributesUITests.m └── Info.plist ├── 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 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /DWQSelectAttributes.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0429AE421E67B788007378EE /* 取消.png in Resources */ = {isa = PBXBuildFile; fileRef = 0429AE411E67B788007378EE /* 取消.png */; }; 11 | 0429AE441E67B80A007378EE /* 凯迪拉克.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 0429AE431E67B80A007378EE /* 凯迪拉克.jpg */; }; 12 | 0429AE461E67BBA1007378EE /* DWQ-LOGO.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 0429AE451E67BBA1007378EE /* DWQ-LOGO.jpeg */; }; 13 | 04F72BD91E5C300B00B8BAAF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F72BD81E5C300B00B8BAAF /* main.m */; }; 14 | 04F72BDC1E5C300B00B8BAAF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F72BDB1E5C300B00B8BAAF /* AppDelegate.m */; }; 15 | 04F72BDF1E5C300B00B8BAAF /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F72BDE1E5C300B00B8BAAF /* ViewController.m */; }; 16 | 04F72BE21E5C300B00B8BAAF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 04F72BE01E5C300B00B8BAAF /* Main.storyboard */; }; 17 | 04F72BE41E5C300B00B8BAAF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 04F72BE31E5C300B00B8BAAF /* Assets.xcassets */; }; 18 | 04F72BE71E5C300B00B8BAAF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 04F72BE51E5C300B00B8BAAF /* LaunchScreen.storyboard */; }; 19 | 04F72BF21E5C300B00B8BAAF /* DWQSelectAttributesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F72BF11E5C300B00B8BAAF /* DWQSelectAttributesTests.m */; }; 20 | 04F72BFD1E5C300B00B8BAAF /* DWQSelectAttributesUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F72BFC1E5C300B00B8BAAF /* DWQSelectAttributesUITests.m */; }; 21 | 04F72C0E1E5C308F00B8BAAF /* UIView+DWQExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F72C0D1E5C308F00B8BAAF /* UIView+DWQExtension.m */; }; 22 | 04F72C111E5C318800B8BAAF /* DWQSelectAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F72C101E5C318800B8BAAF /* DWQSelectAttributes.m */; }; 23 | 04F72C151E5C32E500B8BAAF /* DWQSelectView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F72C141E5C32E500B8BAAF /* DWQSelectView.m */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | 04F72BEE1E5C300B00B8BAAF /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 04F72BCC1E5C300B00B8BAAF /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = 04F72BD31E5C300B00B8BAAF; 32 | remoteInfo = DWQSelectAttributes; 33 | }; 34 | 04F72BF91E5C300B00B8BAAF /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 04F72BCC1E5C300B00B8BAAF /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = 04F72BD31E5C300B00B8BAAF; 39 | remoteInfo = DWQSelectAttributes; 40 | }; 41 | /* End PBXContainerItemProxy section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | 0429AE411E67B788007378EE /* 取消.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "取消.png"; sourceTree = ""; }; 45 | 0429AE431E67B80A007378EE /* 凯迪拉克.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "凯迪拉克.jpg"; sourceTree = ""; }; 46 | 0429AE451E67BBA1007378EE /* DWQ-LOGO.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "DWQ-LOGO.jpeg"; sourceTree = ""; }; 47 | 04F72BD41E5C300B00B8BAAF /* DWQSelectAttributes.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DWQSelectAttributes.app; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 04F72BD81E5C300B00B8BAAF /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 49 | 04F72BDA1E5C300B00B8BAAF /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 50 | 04F72BDB1E5C300B00B8BAAF /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 51 | 04F72BDD1E5C300B00B8BAAF /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 52 | 04F72BDE1E5C300B00B8BAAF /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 53 | 04F72BE11E5C300B00B8BAAF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 54 | 04F72BE31E5C300B00B8BAAF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 55 | 04F72BE61E5C300B00B8BAAF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 56 | 04F72BE81E5C300B00B8BAAF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | 04F72BED1E5C300B00B8BAAF /* DWQSelectAttributesTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DWQSelectAttributesTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | 04F72BF11E5C300B00B8BAAF /* DWQSelectAttributesTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DWQSelectAttributesTests.m; sourceTree = ""; }; 59 | 04F72BF31E5C300B00B8BAAF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | 04F72BF81E5C300B00B8BAAF /* DWQSelectAttributesUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DWQSelectAttributesUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 61 | 04F72BFC1E5C300B00B8BAAF /* DWQSelectAttributesUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DWQSelectAttributesUITests.m; sourceTree = ""; }; 62 | 04F72BFE1E5C300B00B8BAAF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 63 | 04F72C0C1E5C308F00B8BAAF /* UIView+DWQExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+DWQExtension.h"; sourceTree = ""; }; 64 | 04F72C0D1E5C308F00B8BAAF /* UIView+DWQExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+DWQExtension.m"; sourceTree = ""; }; 65 | 04F72C0F1E5C318800B8BAAF /* DWQSelectAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWQSelectAttributes.h; sourceTree = ""; }; 66 | 04F72C101E5C318800B8BAAF /* DWQSelectAttributes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWQSelectAttributes.m; sourceTree = ""; }; 67 | 04F72C121E5C322800B8BAAF /* PrefixHeader.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = ""; }; 68 | 04F72C131E5C32E500B8BAAF /* DWQSelectView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWQSelectView.h; sourceTree = ""; }; 69 | 04F72C141E5C32E500B8BAAF /* DWQSelectView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWQSelectView.m; sourceTree = ""; }; 70 | /* End PBXFileReference section */ 71 | 72 | /* Begin PBXFrameworksBuildPhase section */ 73 | 04F72BD11E5C300B00B8BAAF /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | 04F72BEA1E5C300B00B8BAAF /* Frameworks */ = { 81 | isa = PBXFrameworksBuildPhase; 82 | buildActionMask = 2147483647; 83 | files = ( 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | 04F72BF51E5C300B00B8BAAF /* Frameworks */ = { 88 | isa = PBXFrameworksBuildPhase; 89 | buildActionMask = 2147483647; 90 | files = ( 91 | ); 92 | runOnlyForDeploymentPostprocessing = 0; 93 | }; 94 | /* End PBXFrameworksBuildPhase section */ 95 | 96 | /* Begin PBXGroup section */ 97 | 04F72BCB1E5C300B00B8BAAF = { 98 | isa = PBXGroup; 99 | children = ( 100 | 04F72BD61E5C300B00B8BAAF /* DWQSelectAttributes */, 101 | 04F72BF01E5C300B00B8BAAF /* DWQSelectAttributesTests */, 102 | 04F72BFB1E5C300B00B8BAAF /* DWQSelectAttributesUITests */, 103 | 04F72BD51E5C300B00B8BAAF /* Products */, 104 | ); 105 | sourceTree = ""; 106 | }; 107 | 04F72BD51E5C300B00B8BAAF /* Products */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 04F72BD41E5C300B00B8BAAF /* DWQSelectAttributes.app */, 111 | 04F72BED1E5C300B00B8BAAF /* DWQSelectAttributesTests.xctest */, 112 | 04F72BF81E5C300B00B8BAAF /* DWQSelectAttributesUITests.xctest */, 113 | ); 114 | name = Products; 115 | sourceTree = ""; 116 | }; 117 | 04F72BD61E5C300B00B8BAAF /* DWQSelectAttributes */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 04F72C0A1E5C306300B8BAAF /* DWQExtension */, 121 | 04F72C0B1E5C306300B8BAAF /* DWQSelectAttributesView */, 122 | 04F72BDA1E5C300B00B8BAAF /* AppDelegate.h */, 123 | 04F72BDB1E5C300B00B8BAAF /* AppDelegate.m */, 124 | 04F72BDD1E5C300B00B8BAAF /* ViewController.h */, 125 | 04F72BDE1E5C300B00B8BAAF /* ViewController.m */, 126 | 04F72C121E5C322800B8BAAF /* PrefixHeader.pch */, 127 | 04F72BE01E5C300B00B8BAAF /* Main.storyboard */, 128 | 04F72BE31E5C300B00B8BAAF /* Assets.xcassets */, 129 | 04F72BE51E5C300B00B8BAAF /* LaunchScreen.storyboard */, 130 | 04F72BE81E5C300B00B8BAAF /* Info.plist */, 131 | 04F72BD71E5C300B00B8BAAF /* Supporting Files */, 132 | ); 133 | path = DWQSelectAttributes; 134 | sourceTree = ""; 135 | }; 136 | 04F72BD71E5C300B00B8BAAF /* Supporting Files */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 04F72BD81E5C300B00B8BAAF /* main.m */, 140 | ); 141 | name = "Supporting Files"; 142 | sourceTree = ""; 143 | }; 144 | 04F72BF01E5C300B00B8BAAF /* DWQSelectAttributesTests */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 04F72BF11E5C300B00B8BAAF /* DWQSelectAttributesTests.m */, 148 | 04F72BF31E5C300B00B8BAAF /* Info.plist */, 149 | ); 150 | path = DWQSelectAttributesTests; 151 | sourceTree = ""; 152 | }; 153 | 04F72BFB1E5C300B00B8BAAF /* DWQSelectAttributesUITests */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 04F72BFC1E5C300B00B8BAAF /* DWQSelectAttributesUITests.m */, 157 | 04F72BFE1E5C300B00B8BAAF /* Info.plist */, 158 | ); 159 | path = DWQSelectAttributesUITests; 160 | sourceTree = ""; 161 | }; 162 | 04F72C0A1E5C306300B8BAAF /* DWQExtension */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 04F72C0C1E5C308F00B8BAAF /* UIView+DWQExtension.h */, 166 | 04F72C0D1E5C308F00B8BAAF /* UIView+DWQExtension.m */, 167 | ); 168 | path = DWQExtension; 169 | sourceTree = ""; 170 | }; 171 | 04F72C0B1E5C306300B8BAAF /* DWQSelectAttributesView */ = { 172 | isa = PBXGroup; 173 | children = ( 174 | 0429AE451E67BBA1007378EE /* DWQ-LOGO.jpeg */, 175 | 0429AE431E67B80A007378EE /* 凯迪拉克.jpg */, 176 | 0429AE411E67B788007378EE /* 取消.png */, 177 | 04F72C0F1E5C318800B8BAAF /* DWQSelectAttributes.h */, 178 | 04F72C101E5C318800B8BAAF /* DWQSelectAttributes.m */, 179 | 04F72C131E5C32E500B8BAAF /* DWQSelectView.h */, 180 | 04F72C141E5C32E500B8BAAF /* DWQSelectView.m */, 181 | ); 182 | path = DWQSelectAttributesView; 183 | sourceTree = ""; 184 | }; 185 | /* End PBXGroup section */ 186 | 187 | /* Begin PBXNativeTarget section */ 188 | 04F72BD31E5C300B00B8BAAF /* DWQSelectAttributes */ = { 189 | isa = PBXNativeTarget; 190 | buildConfigurationList = 04F72C011E5C300B00B8BAAF /* Build configuration list for PBXNativeTarget "DWQSelectAttributes" */; 191 | buildPhases = ( 192 | 04F72BD01E5C300B00B8BAAF /* Sources */, 193 | 04F72BD11E5C300B00B8BAAF /* Frameworks */, 194 | 04F72BD21E5C300B00B8BAAF /* Resources */, 195 | ); 196 | buildRules = ( 197 | ); 198 | dependencies = ( 199 | ); 200 | name = DWQSelectAttributes; 201 | productName = DWQSelectAttributes; 202 | productReference = 04F72BD41E5C300B00B8BAAF /* DWQSelectAttributes.app */; 203 | productType = "com.apple.product-type.application"; 204 | }; 205 | 04F72BEC1E5C300B00B8BAAF /* DWQSelectAttributesTests */ = { 206 | isa = PBXNativeTarget; 207 | buildConfigurationList = 04F72C041E5C300B00B8BAAF /* Build configuration list for PBXNativeTarget "DWQSelectAttributesTests" */; 208 | buildPhases = ( 209 | 04F72BE91E5C300B00B8BAAF /* Sources */, 210 | 04F72BEA1E5C300B00B8BAAF /* Frameworks */, 211 | 04F72BEB1E5C300B00B8BAAF /* Resources */, 212 | ); 213 | buildRules = ( 214 | ); 215 | dependencies = ( 216 | 04F72BEF1E5C300B00B8BAAF /* PBXTargetDependency */, 217 | ); 218 | name = DWQSelectAttributesTests; 219 | productName = DWQSelectAttributesTests; 220 | productReference = 04F72BED1E5C300B00B8BAAF /* DWQSelectAttributesTests.xctest */; 221 | productType = "com.apple.product-type.bundle.unit-test"; 222 | }; 223 | 04F72BF71E5C300B00B8BAAF /* DWQSelectAttributesUITests */ = { 224 | isa = PBXNativeTarget; 225 | buildConfigurationList = 04F72C071E5C300B00B8BAAF /* Build configuration list for PBXNativeTarget "DWQSelectAttributesUITests" */; 226 | buildPhases = ( 227 | 04F72BF41E5C300B00B8BAAF /* Sources */, 228 | 04F72BF51E5C300B00B8BAAF /* Frameworks */, 229 | 04F72BF61E5C300B00B8BAAF /* Resources */, 230 | ); 231 | buildRules = ( 232 | ); 233 | dependencies = ( 234 | 04F72BFA1E5C300B00B8BAAF /* PBXTargetDependency */, 235 | ); 236 | name = DWQSelectAttributesUITests; 237 | productName = DWQSelectAttributesUITests; 238 | productReference = 04F72BF81E5C300B00B8BAAF /* DWQSelectAttributesUITests.xctest */; 239 | productType = "com.apple.product-type.bundle.ui-testing"; 240 | }; 241 | /* End PBXNativeTarget section */ 242 | 243 | /* Begin PBXProject section */ 244 | 04F72BCC1E5C300B00B8BAAF /* Project object */ = { 245 | isa = PBXProject; 246 | attributes = { 247 | LastUpgradeCheck = 0810; 248 | ORGANIZATIONNAME = com.sdzw.duwenquan; 249 | TargetAttributes = { 250 | 04F72BD31E5C300B00B8BAAF = { 251 | CreatedOnToolsVersion = 8.1; 252 | DevelopmentTeam = N8RQBX5PQW; 253 | ProvisioningStyle = Automatic; 254 | }; 255 | 04F72BEC1E5C300B00B8BAAF = { 256 | CreatedOnToolsVersion = 8.1; 257 | DevelopmentTeam = N8RQBX5PQW; 258 | ProvisioningStyle = Automatic; 259 | TestTargetID = 04F72BD31E5C300B00B8BAAF; 260 | }; 261 | 04F72BF71E5C300B00B8BAAF = { 262 | CreatedOnToolsVersion = 8.1; 263 | DevelopmentTeam = N8RQBX5PQW; 264 | ProvisioningStyle = Automatic; 265 | TestTargetID = 04F72BD31E5C300B00B8BAAF; 266 | }; 267 | }; 268 | }; 269 | buildConfigurationList = 04F72BCF1E5C300B00B8BAAF /* Build configuration list for PBXProject "DWQSelectAttributes" */; 270 | compatibilityVersion = "Xcode 3.2"; 271 | developmentRegion = English; 272 | hasScannedForEncodings = 0; 273 | knownRegions = ( 274 | en, 275 | Base, 276 | ); 277 | mainGroup = 04F72BCB1E5C300B00B8BAAF; 278 | productRefGroup = 04F72BD51E5C300B00B8BAAF /* Products */; 279 | projectDirPath = ""; 280 | projectRoot = ""; 281 | targets = ( 282 | 04F72BD31E5C300B00B8BAAF /* DWQSelectAttributes */, 283 | 04F72BEC1E5C300B00B8BAAF /* DWQSelectAttributesTests */, 284 | 04F72BF71E5C300B00B8BAAF /* DWQSelectAttributesUITests */, 285 | ); 286 | }; 287 | /* End PBXProject section */ 288 | 289 | /* Begin PBXResourcesBuildPhase section */ 290 | 04F72BD21E5C300B00B8BAAF /* Resources */ = { 291 | isa = PBXResourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | 04F72BE71E5C300B00B8BAAF /* LaunchScreen.storyboard in Resources */, 295 | 04F72BE41E5C300B00B8BAAF /* Assets.xcassets in Resources */, 296 | 0429AE441E67B80A007378EE /* 凯迪拉克.jpg in Resources */, 297 | 0429AE461E67BBA1007378EE /* DWQ-LOGO.jpeg in Resources */, 298 | 04F72BE21E5C300B00B8BAAF /* Main.storyboard in Resources */, 299 | 0429AE421E67B788007378EE /* 取消.png in Resources */, 300 | ); 301 | runOnlyForDeploymentPostprocessing = 0; 302 | }; 303 | 04F72BEB1E5C300B00B8BAAF /* Resources */ = { 304 | isa = PBXResourcesBuildPhase; 305 | buildActionMask = 2147483647; 306 | files = ( 307 | ); 308 | runOnlyForDeploymentPostprocessing = 0; 309 | }; 310 | 04F72BF61E5C300B00B8BAAF /* Resources */ = { 311 | isa = PBXResourcesBuildPhase; 312 | buildActionMask = 2147483647; 313 | files = ( 314 | ); 315 | runOnlyForDeploymentPostprocessing = 0; 316 | }; 317 | /* End PBXResourcesBuildPhase section */ 318 | 319 | /* Begin PBXSourcesBuildPhase section */ 320 | 04F72BD01E5C300B00B8BAAF /* Sources */ = { 321 | isa = PBXSourcesBuildPhase; 322 | buildActionMask = 2147483647; 323 | files = ( 324 | 04F72BDF1E5C300B00B8BAAF /* ViewController.m in Sources */, 325 | 04F72C0E1E5C308F00B8BAAF /* UIView+DWQExtension.m in Sources */, 326 | 04F72BDC1E5C300B00B8BAAF /* AppDelegate.m in Sources */, 327 | 04F72C111E5C318800B8BAAF /* DWQSelectAttributes.m in Sources */, 328 | 04F72BD91E5C300B00B8BAAF /* main.m in Sources */, 329 | 04F72C151E5C32E500B8BAAF /* DWQSelectView.m in Sources */, 330 | ); 331 | runOnlyForDeploymentPostprocessing = 0; 332 | }; 333 | 04F72BE91E5C300B00B8BAAF /* Sources */ = { 334 | isa = PBXSourcesBuildPhase; 335 | buildActionMask = 2147483647; 336 | files = ( 337 | 04F72BF21E5C300B00B8BAAF /* DWQSelectAttributesTests.m in Sources */, 338 | ); 339 | runOnlyForDeploymentPostprocessing = 0; 340 | }; 341 | 04F72BF41E5C300B00B8BAAF /* Sources */ = { 342 | isa = PBXSourcesBuildPhase; 343 | buildActionMask = 2147483647; 344 | files = ( 345 | 04F72BFD1E5C300B00B8BAAF /* DWQSelectAttributesUITests.m in Sources */, 346 | ); 347 | runOnlyForDeploymentPostprocessing = 0; 348 | }; 349 | /* End PBXSourcesBuildPhase section */ 350 | 351 | /* Begin PBXTargetDependency section */ 352 | 04F72BEF1E5C300B00B8BAAF /* PBXTargetDependency */ = { 353 | isa = PBXTargetDependency; 354 | target = 04F72BD31E5C300B00B8BAAF /* DWQSelectAttributes */; 355 | targetProxy = 04F72BEE1E5C300B00B8BAAF /* PBXContainerItemProxy */; 356 | }; 357 | 04F72BFA1E5C300B00B8BAAF /* PBXTargetDependency */ = { 358 | isa = PBXTargetDependency; 359 | target = 04F72BD31E5C300B00B8BAAF /* DWQSelectAttributes */; 360 | targetProxy = 04F72BF91E5C300B00B8BAAF /* PBXContainerItemProxy */; 361 | }; 362 | /* End PBXTargetDependency section */ 363 | 364 | /* Begin PBXVariantGroup section */ 365 | 04F72BE01E5C300B00B8BAAF /* Main.storyboard */ = { 366 | isa = PBXVariantGroup; 367 | children = ( 368 | 04F72BE11E5C300B00B8BAAF /* Base */, 369 | ); 370 | name = Main.storyboard; 371 | sourceTree = ""; 372 | }; 373 | 04F72BE51E5C300B00B8BAAF /* LaunchScreen.storyboard */ = { 374 | isa = PBXVariantGroup; 375 | children = ( 376 | 04F72BE61E5C300B00B8BAAF /* Base */, 377 | ); 378 | name = LaunchScreen.storyboard; 379 | sourceTree = ""; 380 | }; 381 | /* End PBXVariantGroup section */ 382 | 383 | /* Begin XCBuildConfiguration section */ 384 | 04F72BFF1E5C300B00B8BAAF /* Debug */ = { 385 | isa = XCBuildConfiguration; 386 | buildSettings = { 387 | ALWAYS_SEARCH_USER_PATHS = NO; 388 | CLANG_ANALYZER_NONNULL = YES; 389 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 390 | CLANG_CXX_LIBRARY = "libc++"; 391 | CLANG_ENABLE_MODULES = YES; 392 | CLANG_ENABLE_OBJC_ARC = YES; 393 | CLANG_WARN_BOOL_CONVERSION = YES; 394 | CLANG_WARN_CONSTANT_CONVERSION = YES; 395 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 396 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 397 | CLANG_WARN_EMPTY_BODY = YES; 398 | CLANG_WARN_ENUM_CONVERSION = YES; 399 | CLANG_WARN_INFINITE_RECURSION = YES; 400 | CLANG_WARN_INT_CONVERSION = YES; 401 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 402 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 403 | CLANG_WARN_UNREACHABLE_CODE = YES; 404 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 405 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 406 | COPY_PHASE_STRIP = NO; 407 | DEBUG_INFORMATION_FORMAT = dwarf; 408 | ENABLE_STRICT_OBJC_MSGSEND = YES; 409 | ENABLE_TESTABILITY = YES; 410 | GCC_C_LANGUAGE_STANDARD = gnu99; 411 | GCC_DYNAMIC_NO_PIC = NO; 412 | GCC_NO_COMMON_BLOCKS = YES; 413 | GCC_OPTIMIZATION_LEVEL = 0; 414 | GCC_PREPROCESSOR_DEFINITIONS = ( 415 | "DEBUG=1", 416 | "$(inherited)", 417 | ); 418 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 419 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 420 | GCC_WARN_UNDECLARED_SELECTOR = YES; 421 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 422 | GCC_WARN_UNUSED_FUNCTION = YES; 423 | GCC_WARN_UNUSED_VARIABLE = YES; 424 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 425 | MTL_ENABLE_DEBUG_INFO = YES; 426 | ONLY_ACTIVE_ARCH = YES; 427 | SDKROOT = iphoneos; 428 | }; 429 | name = Debug; 430 | }; 431 | 04F72C001E5C300B00B8BAAF /* Release */ = { 432 | isa = XCBuildConfiguration; 433 | buildSettings = { 434 | ALWAYS_SEARCH_USER_PATHS = NO; 435 | CLANG_ANALYZER_NONNULL = YES; 436 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 437 | CLANG_CXX_LIBRARY = "libc++"; 438 | CLANG_ENABLE_MODULES = YES; 439 | CLANG_ENABLE_OBJC_ARC = YES; 440 | CLANG_WARN_BOOL_CONVERSION = YES; 441 | CLANG_WARN_CONSTANT_CONVERSION = YES; 442 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 443 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 444 | CLANG_WARN_EMPTY_BODY = YES; 445 | CLANG_WARN_ENUM_CONVERSION = YES; 446 | CLANG_WARN_INFINITE_RECURSION = YES; 447 | CLANG_WARN_INT_CONVERSION = YES; 448 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 449 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 450 | CLANG_WARN_UNREACHABLE_CODE = YES; 451 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 452 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 453 | COPY_PHASE_STRIP = NO; 454 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 455 | ENABLE_NS_ASSERTIONS = NO; 456 | ENABLE_STRICT_OBJC_MSGSEND = YES; 457 | GCC_C_LANGUAGE_STANDARD = gnu99; 458 | GCC_NO_COMMON_BLOCKS = YES; 459 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 460 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 461 | GCC_WARN_UNDECLARED_SELECTOR = YES; 462 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 463 | GCC_WARN_UNUSED_FUNCTION = YES; 464 | GCC_WARN_UNUSED_VARIABLE = YES; 465 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 466 | MTL_ENABLE_DEBUG_INFO = NO; 467 | SDKROOT = iphoneos; 468 | VALIDATE_PRODUCT = YES; 469 | }; 470 | name = Release; 471 | }; 472 | 04F72C021E5C300B00B8BAAF /* Debug */ = { 473 | isa = XCBuildConfiguration; 474 | buildSettings = { 475 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 476 | DEVELOPMENT_TEAM = N8RQBX5PQW; 477 | GCC_PREFIX_HEADER = /Users/mac/Desktop/DWQSelectAttributes/DWQSelectAttributes/PrefixHeader.pch; 478 | INFOPLIST_FILE = DWQSelectAttributes/Info.plist; 479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 480 | PRODUCT_BUNDLE_IDENTIFIER = com.sdzw.DWQSelectAttributes; 481 | PRODUCT_NAME = "$(TARGET_NAME)"; 482 | }; 483 | name = Debug; 484 | }; 485 | 04F72C031E5C300B00B8BAAF /* Release */ = { 486 | isa = XCBuildConfiguration; 487 | buildSettings = { 488 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 489 | DEVELOPMENT_TEAM = N8RQBX5PQW; 490 | GCC_PREFIX_HEADER = /Users/mac/Desktop/DWQSelectAttributes/DWQSelectAttributes/PrefixHeader.pch; 491 | INFOPLIST_FILE = DWQSelectAttributes/Info.plist; 492 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 493 | PRODUCT_BUNDLE_IDENTIFIER = com.sdzw.DWQSelectAttributes; 494 | PRODUCT_NAME = "$(TARGET_NAME)"; 495 | }; 496 | name = Release; 497 | }; 498 | 04F72C051E5C300B00B8BAAF /* Debug */ = { 499 | isa = XCBuildConfiguration; 500 | buildSettings = { 501 | BUNDLE_LOADER = "$(TEST_HOST)"; 502 | DEVELOPMENT_TEAM = N8RQBX5PQW; 503 | INFOPLIST_FILE = DWQSelectAttributesTests/Info.plist; 504 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 505 | PRODUCT_BUNDLE_IDENTIFIER = com.sdzw.DWQSelectAttributesTests; 506 | PRODUCT_NAME = "$(TARGET_NAME)"; 507 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DWQSelectAttributes.app/DWQSelectAttributes"; 508 | }; 509 | name = Debug; 510 | }; 511 | 04F72C061E5C300B00B8BAAF /* Release */ = { 512 | isa = XCBuildConfiguration; 513 | buildSettings = { 514 | BUNDLE_LOADER = "$(TEST_HOST)"; 515 | DEVELOPMENT_TEAM = N8RQBX5PQW; 516 | INFOPLIST_FILE = DWQSelectAttributesTests/Info.plist; 517 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 518 | PRODUCT_BUNDLE_IDENTIFIER = com.sdzw.DWQSelectAttributesTests; 519 | PRODUCT_NAME = "$(TARGET_NAME)"; 520 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DWQSelectAttributes.app/DWQSelectAttributes"; 521 | }; 522 | name = Release; 523 | }; 524 | 04F72C081E5C300B00B8BAAF /* Debug */ = { 525 | isa = XCBuildConfiguration; 526 | buildSettings = { 527 | DEVELOPMENT_TEAM = N8RQBX5PQW; 528 | INFOPLIST_FILE = DWQSelectAttributesUITests/Info.plist; 529 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 530 | PRODUCT_BUNDLE_IDENTIFIER = com.sdzw.DWQSelectAttributesUITests; 531 | PRODUCT_NAME = "$(TARGET_NAME)"; 532 | TEST_TARGET_NAME = DWQSelectAttributes; 533 | }; 534 | name = Debug; 535 | }; 536 | 04F72C091E5C300B00B8BAAF /* Release */ = { 537 | isa = XCBuildConfiguration; 538 | buildSettings = { 539 | DEVELOPMENT_TEAM = N8RQBX5PQW; 540 | INFOPLIST_FILE = DWQSelectAttributesUITests/Info.plist; 541 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 542 | PRODUCT_BUNDLE_IDENTIFIER = com.sdzw.DWQSelectAttributesUITests; 543 | PRODUCT_NAME = "$(TARGET_NAME)"; 544 | TEST_TARGET_NAME = DWQSelectAttributes; 545 | }; 546 | name = Release; 547 | }; 548 | /* End XCBuildConfiguration section */ 549 | 550 | /* Begin XCConfigurationList section */ 551 | 04F72BCF1E5C300B00B8BAAF /* Build configuration list for PBXProject "DWQSelectAttributes" */ = { 552 | isa = XCConfigurationList; 553 | buildConfigurations = ( 554 | 04F72BFF1E5C300B00B8BAAF /* Debug */, 555 | 04F72C001E5C300B00B8BAAF /* Release */, 556 | ); 557 | defaultConfigurationIsVisible = 0; 558 | defaultConfigurationName = Release; 559 | }; 560 | 04F72C011E5C300B00B8BAAF /* Build configuration list for PBXNativeTarget "DWQSelectAttributes" */ = { 561 | isa = XCConfigurationList; 562 | buildConfigurations = ( 563 | 04F72C021E5C300B00B8BAAF /* Debug */, 564 | 04F72C031E5C300B00B8BAAF /* Release */, 565 | ); 566 | defaultConfigurationIsVisible = 0; 567 | defaultConfigurationName = Release; 568 | }; 569 | 04F72C041E5C300B00B8BAAF /* Build configuration list for PBXNativeTarget "DWQSelectAttributesTests" */ = { 570 | isa = XCConfigurationList; 571 | buildConfigurations = ( 572 | 04F72C051E5C300B00B8BAAF /* Debug */, 573 | 04F72C061E5C300B00B8BAAF /* Release */, 574 | ); 575 | defaultConfigurationIsVisible = 0; 576 | defaultConfigurationName = Release; 577 | }; 578 | 04F72C071E5C300B00B8BAAF /* Build configuration list for PBXNativeTarget "DWQSelectAttributesUITests" */ = { 579 | isa = XCConfigurationList; 580 | buildConfigurations = ( 581 | 04F72C081E5C300B00B8BAAF /* Debug */, 582 | 04F72C091E5C300B00B8BAAF /* Release */, 583 | ); 584 | defaultConfigurationIsVisible = 0; 585 | defaultConfigurationName = Release; 586 | }; 587 | /* End XCConfigurationList section */ 588 | }; 589 | rootObject = 04F72BCC1E5C300B00B8BAAF /* Project object */; 590 | } 591 | -------------------------------------------------------------------------------- /DWQSelectAttributes.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DWQSelectAttributes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DWQSelectAttributes 4 | // 5 | // Created by 杜文全 on 15/5/21. 6 | // Copyright © 2015年 com.sdzw.duwenquan. 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 | -------------------------------------------------------------------------------- /DWQSelectAttributes/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DWQSelectAttributes 4 | // 5 | // Created by 杜文全 on 15/5/21. 6 | // Copyright © 2015年 com.sdzw.duwenquan. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 20 | 21 | self.window.backgroundColor = [UIColor whiteColor]; 22 | 23 | [self.window makeKeyAndVisible]; 24 | 25 | self.window.rootViewController = [[ViewController alloc] init]; 26 | 27 | return YES; 28 | } 29 | 30 | 31 | - (void)applicationWillResignActive:(UIApplication *)application { 32 | // 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. 33 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 34 | } 35 | 36 | 37 | - (void)applicationDidEnterBackground:(UIApplication *)application { 38 | // 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. 39 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 40 | } 41 | 42 | 43 | - (void)applicationWillEnterForeground:(UIApplication *)application { 44 | // 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. 45 | } 46 | 47 | 48 | - (void)applicationDidBecomeActive:(UIApplication *)application { 49 | // 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. 50 | } 51 | 52 | 53 | - (void)applicationWillTerminate:(UIApplication *)application { 54 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 55 | } 56 | 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /DWQSelectAttributes/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /DWQSelectAttributes/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 | -------------------------------------------------------------------------------- /DWQSelectAttributes/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 | -------------------------------------------------------------------------------- /DWQSelectAttributes/DWQExtension/UIView+DWQExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+DWQExtension.h 3 | // DWQSelectAttributes 4 | // 5 | // Created by 杜文全 on 14/7/13. 6 | // Copyright © 2014年 com.sdzw.duwenquan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (DWQExtension) 12 | @property(nonatomic,assign)CGFloat dwq_x; 13 | @property(nonatomic,assign)CGFloat dwq_y; 14 | @property(nonatomic,assign)CGFloat dwq_width; 15 | @property(nonatomic,assign)CGFloat dwq_height; 16 | @property(nonatomic,assign)CGSize dwq_size; 17 | @property(nonatomic,assign)CGPoint dwq_origin; 18 | 19 | @property(nonatomic,assign)CGFloat dwq_centerX; 20 | @property(nonatomic,assign)CGFloat dwq_centerY; 21 | @end 22 | -------------------------------------------------------------------------------- /DWQSelectAttributes/DWQExtension/UIView+DWQExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+DWQExtension.m 3 | // DWQSelectAttributes 4 | // 5 | // Created by 杜文全 on 14/7/13. 6 | // Copyright © 2014年 com.sdzw.duwenquan. All rights reserved. 7 | // 8 | 9 | #import "UIView+DWQExtension.h" 10 | 11 | @implementation UIView (DWQExtension) 12 | 13 | 14 | -(void)setDwq_x:(CGFloat)dwq_x{ 15 | CGRect frame = self.frame; 16 | frame.origin.x = dwq_x; 17 | self.frame = frame; 18 | 19 | } 20 | 21 | -(void)setDwq_y:(CGFloat)dwq_y{ 22 | 23 | CGRect frame = self.frame; 24 | frame.origin.y = dwq_y; 25 | self.frame = frame; 26 | } 27 | 28 | -(CGFloat)dwq_x{ 29 | 30 | return self.frame.origin.x; 31 | } 32 | 33 | -(CGFloat)dwq_y{ 34 | 35 | return self.frame.origin.y; 36 | } 37 | 38 | -(void)setDwq_centerX:(CGFloat)dwq_centerX{ 39 | 40 | CGPoint center = self.center; 41 | center.x = dwq_centerX; 42 | self.center = center; 43 | } 44 | 45 | 46 | -(CGFloat)dwq_centerX{ 47 | 48 | return self.center.x; 49 | } 50 | 51 | -(void)setDwq_centerY:(CGFloat)dwq_centerY{ 52 | 53 | CGPoint center = self.center; 54 | center.y = dwq_centerY; 55 | self.center = center; 56 | } 57 | 58 | 59 | -(CGFloat)dwq_centerY{ 60 | 61 | return self.center.y; 62 | } 63 | 64 | -(void)setDwq_width:(CGFloat)dwq_width{ 65 | CGRect frame = self.frame; 66 | frame.size.width = dwq_width; 67 | self.frame = frame; 68 | 69 | } 70 | -(void)setDwq_height:(CGFloat)dwq_height{ 71 | CGRect frame = self.frame; 72 | frame.size.height = dwq_height; 73 | self.frame = frame; 74 | 75 | } 76 | 77 | 78 | -(CGFloat)dwq_height{ 79 | 80 | return self.frame.size.height; 81 | } 82 | 83 | -(CGFloat)dwq_width{ 84 | 85 | return self.frame.size.width; 86 | } 87 | 88 | -(void)setDwq_size:(CGSize)dwq_size{ 89 | 90 | CGRect freme = self.frame; 91 | freme.size = dwq_size; 92 | self.frame = freme; 93 | 94 | } 95 | 96 | 97 | -(CGSize)dwq_size{ 98 | 99 | return self.frame.size; 100 | } 101 | 102 | -(void)setDwq_origin:(CGPoint)dwq_origin{ 103 | 104 | CGRect frame = self.frame; 105 | frame.origin = dwq_origin; 106 | self.frame = frame; 107 | } 108 | 109 | -(CGPoint)dwq_origin{ 110 | 111 | return self.frame.origin; 112 | } 113 | 114 | 115 | @end 116 | -------------------------------------------------------------------------------- /DWQSelectAttributes/DWQSelectAttributesView/DWQ-LOGO.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevelopmentEngineer-DWQ/DWQSelectAttributes/2b3264117a2799dc109940c7d7f5069bf3e7b74c/DWQSelectAttributes/DWQSelectAttributesView/DWQ-LOGO.jpeg -------------------------------------------------------------------------------- /DWQSelectAttributes/DWQSelectAttributesView/DWQSelectAttributes.h: -------------------------------------------------------------------------------- 1 | // 2 | // DWQSelectAttributes.h 3 | // DWQSelectAttributes 4 | // 5 | // Created by 杜文全 on 15/5/21. 6 | // Copyright © 2015年 com.sdzw.duwenquan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "UIView+DWQExtension.h" 12 | 13 | @protocol SelectAttributesDelegate 14 | @required 15 | -(void)selectBtnTitle:(NSString *)title andBtn:(UIButton *)btn; 16 | 17 | @end 18 | 19 | @interface DWQSelectAttributes : UIView 20 | 21 | @property(nonatomic,copy)NSString *title; 22 | @property(nonatomic,strong)NSArray *attributesArray; 23 | 24 | @property(nonatomic,strong)UIButton *selectBtn; 25 | 26 | @property(nonatomic,strong)UIView *packView; 27 | @property(nonatomic,strong)UIView *btnView; 28 | 29 | @property(nonatomic,assign)id delegate; 30 | 31 | 32 | 33 | -(instancetype)initWithTitle:(NSString *)title titleArr:(NSArray *)titleArr andFrame:(CGRect)frame; 34 | 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /DWQSelectAttributes/DWQSelectAttributesView/DWQSelectAttributes.m: -------------------------------------------------------------------------------- 1 | // 2 | // DWQSelectAttributes.m 3 | // DWQSelectAttributes 4 | // 5 | // Created by 杜文全 on 15/5/21. 6 | // Copyright © 2015年 com.sdzw.duwenquan. All rights reserved. 7 | // 8 | 9 | #import "DWQSelectAttributes.h" 10 | 11 | @implementation DWQSelectAttributes 12 | 13 | -(instancetype)initWithTitle:(NSString *)title titleArr:(NSArray *)titleArr andFrame:(CGRect)frame{ 14 | 15 | self = [super initWithFrame:frame]; 16 | if (self) { 17 | 18 | self.frame = frame; 19 | self.title = title; 20 | 21 | self.attributesArray = [NSArray arrayWithArray:titleArr]; 22 | 23 | [self rankView]; 24 | } 25 | return self; 26 | } 27 | 28 | 29 | -(void)rankView{ 30 | 31 | self.packView = [[UIView alloc] initWithFrame:self.frame]; 32 | self.packView.dwq_y = 0; 33 | 34 | UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, screen_Width, 0.5)]; 35 | line.backgroundColor = [UIColor lightGrayColor]; 36 | [self.packView addSubview:line]; 37 | 38 | UILabel *titleLB = [[UILabel alloc] initWithFrame:CGRectMake(20, 5, screen_Width, 25)]; 39 | titleLB.text = self.title; 40 | titleLB.font = FONT(15); 41 | [self.packView addSubview:titleLB]; 42 | 43 | self.btnView = [[UIView alloc] initWithFrame:CGRectMake(0,CGRectGetMaxY(titleLB.frame), screen_Width, 40)]; 44 | [self.packView addSubview:self.btnView]; 45 | 46 | int count = 0; 47 | float btnWidth = 0; 48 | float viewHeight = 0; 49 | for (int i = 0; i < self.attributesArray.count; i++) { 50 | 51 | NSString *btnName = self.attributesArray[i]; 52 | 53 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; 54 | [btn setBackgroundColor:BackgroundColor]; 55 | [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 56 | [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected]; 57 | 58 | btn.titleLabel.font = [UIFont systemFontOfSize:14]; 59 | [btn setTitle:btnName forState:UIControlStateNormal]; 60 | [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside]; 61 | 62 | btn.layer.cornerRadius = 5; 63 | btn.layer.masksToBounds = YES; 64 | 65 | NSDictionary *dict = [NSDictionary dictionaryWithObject:FONT(13) forKey:NSFontAttributeName]; 66 | CGSize btnSize = [btnName sizeWithAttributes:dict]; 67 | 68 | btn.dwq_width = btnSize.width + 15; 69 | btn.dwq_height = btnSize.height + 12; 70 | 71 | if (i==0) 72 | { 73 | btn.dwq_x = 20; 74 | btnWidth += CGRectGetMaxX(btn.frame); 75 | } 76 | else{ 77 | btnWidth += CGRectGetMaxX(btn.frame)+20; 78 | if (btnWidth > screen_Width) { 79 | count++; 80 | btn.dwq_x = 20; 81 | btnWidth = CGRectGetMaxX(btn.frame); 82 | } 83 | else{ 84 | 85 | btn.dwq_x += btnWidth - btn.dwq_width; 86 | } 87 | } 88 | btn.dwq_y += count * (btn.dwq_height+10)+10; 89 | 90 | viewHeight = CGRectGetMaxY(btn.frame)+10; 91 | 92 | [self.btnView addSubview:btn]; 93 | 94 | btn.tag = 10000+i; 95 | 96 | 97 | // if ([btnName isEqualToString:self.selectStr]) 98 | // { 99 | // self.selectBtn = btn; 100 | // self.selectBtn.selected = YES; 101 | // self.selectBtn.backgroundColor = [UIColor greenColor]; 102 | // } 103 | 104 | } 105 | self.btnView.dwq_height = viewHeight; 106 | self.packView.dwq_height = self.btnView.dwq_height+CGRectGetMaxY(titleLB.frame); 107 | 108 | self.dwq_height = self.packView.dwq_height; 109 | 110 | [self addSubview:self.packView]; 111 | } 112 | 113 | 114 | -(void)btnClick:(UIButton *)btn{ 115 | 116 | 117 | if (![self.selectBtn isEqual:btn]) { 118 | 119 | self.selectBtn.backgroundColor = BackgroundColor; 120 | self.selectBtn.selected = NO; 121 | 122 | // NSLog(@"%@-----%@",btn.titleLabel.text,[self.rankArray[btn.tag-10000] sequence]); 123 | } 124 | else{ 125 | btn.backgroundColor = SelectColor; 126 | } 127 | btn.backgroundColor = SelectColor; 128 | btn.selected = YES; 129 | 130 | self.selectBtn = btn; 131 | 132 | if ([self.delegate respondsToSelector:@selector(selectBtnTitle:andBtn:)]) { 133 | 134 | [self.delegate selectBtnTitle:btn.titleLabel.text andBtn:self.selectBtn]; 135 | } 136 | } 137 | 138 | @end 139 | -------------------------------------------------------------------------------- /DWQSelectAttributes/DWQSelectAttributesView/DWQSelectView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DWQSelectView.h 3 | // DWQSelectAttributes 4 | // 5 | // Created by 杜文全 on 15/5/21. 6 | // Copyright © 2015年 com.sdzw.duwenquan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DWQSelectView : UIView 12 | @property(nonatomic,strong)UIView *alphaView; 13 | @property(nonatomic,strong)UIView *whiteView; 14 | 15 | @property(nonatomic,strong)UIImageView *headImage; 16 | 17 | @property(nonatomic,strong)UILabel *LB_price; 18 | @property(nonatomic,strong)UILabel *LB_stock; 19 | @property(nonatomic,strong)UILabel *LB_detail; 20 | @property(nonatomic,strong)UILabel *LB_line; 21 | @property(nonatomic,strong)UILabel *LB_showSales; 22 | 23 | 24 | @property(nonatomic,copy)NSString *price; 25 | @property(nonatomic,copy)NSString *stock; 26 | @property(nonatomic,copy)NSString *detail; 27 | @property(nonatomic,copy)NSString *showSales; 28 | 29 | @property(nonatomic,strong)UIScrollView *mainscrollview; 30 | 31 | 32 | @property(nonatomic,strong)UIButton *cancelBtn; 33 | @property(nonatomic,strong)UIButton *buyBtn; 34 | @property(nonatomic,strong)UIButton *addBtn; 35 | @property(nonatomic,strong)UIButton *stockBtn; 36 | 37 | @property(nonatomic,assign) int typeCount; 38 | 39 | @property(nonatomic,strong)UIButton *selectBtn; 40 | 41 | 42 | -(instancetype)initWithFrame:(CGRect)frame; 43 | 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /DWQSelectAttributes/DWQSelectAttributesView/DWQSelectView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DWQSelectView.m 3 | // DWQSelectAttributes 4 | // 5 | // Created by 杜文全 on 15/5/21. 6 | // Copyright © 2015年 com.sdzw.duwenquan. All rights reserved. 7 | // 8 | 9 | #import "DWQSelectView.h" 10 | @interface DWQSelectView () 11 | 12 | //规格分类 13 | @property(nonatomic,strong)NSArray *rankArr; 14 | 15 | @end 16 | @implementation DWQSelectView 17 | 18 | @synthesize alphaView,whiteView,headImage,LB_detail,LB_line,LB_price,LB_stock,LB_showSales,mainscrollview,cancelBtn,addBtn,buyBtn,stockBtn; 19 | 20 | -(instancetype)initWithFrame:(CGRect)frame{ 21 | 22 | self = [super initWithFrame:frame]; 23 | 24 | if (self) { 25 | 26 | self.backgroundColor = [UIColor clearColor]; 27 | 28 | //self.showSales = @"135"; 29 | [self creatUI]; 30 | 31 | } 32 | return self; 33 | } 34 | 35 | 36 | 37 | -(void)creatUI{ 38 | 39 | //半透明视图 40 | alphaView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, screen_Width, screen_Height)]; 41 | alphaView.backgroundColor = [UIColor blackColor]; 42 | alphaView.alpha = 0.3; 43 | [self addSubview:alphaView]; 44 | 45 | //装载商品信息的视图 46 | whiteView = [[UIView alloc] initWithFrame:CGRectMake(0, 200, screen_Width, screen_Height-200)]; 47 | whiteView.backgroundColor = [UIColor whiteColor]; 48 | [self addSubview:whiteView]; 49 | 50 | //商品图片 51 | headImage = [[UIImageView alloc] initWithFrame:CGRectMake(20, 0, 90, 90)]; 52 | headImage.image = [UIImage imageNamed:@"凯迪拉克.jpg"]; 53 | headImage.layer.cornerRadius = 4; 54 | headImage.layer.borderColor = [UIColor lightGrayColor].CGColor; 55 | headImage.layer.borderWidth = 1; 56 | [headImage.layer setMasksToBounds:YES]; 57 | [whiteView addSubview:headImage]; 58 | 59 | cancelBtn= [UIButton buttonWithType:UIButtonTypeCustom]; 60 | cancelBtn.frame = CGRectMake(screen_Width-40, 10, 25, 25); 61 | [cancelBtn setBackgroundImage:[UIImage imageNamed:@"取消"] forState:0]; 62 | [whiteView addSubview:cancelBtn]; 63 | 64 | 65 | //商品价格 66 | LB_price = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(headImage.frame)+20, 10, 150, 20)]; 67 | LB_price.text = @"¥100"; 68 | LB_price.textColor = [UIColor redColor]; 69 | LB_price.font = [UIFont systemFontOfSize:16]; 70 | [whiteView addSubview:LB_price]; 71 | //商品库存 72 | LB_stock = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(headImage.frame)+20, CGRectGetMaxY(LB_price.frame), 80, 20)]; 73 | LB_stock.text = @"库存10000件"; 74 | LB_stock.textColor = [UIColor blackColor]; 75 | LB_stock.font = [UIFont systemFontOfSize:13]; 76 | [whiteView addSubview:LB_stock]; 77 | 78 | //已售件数 79 | LB_showSales = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(LB_stock.frame), CGRectGetMaxY(LB_price.frame), 80, 20)]; 80 | LB_showSales.textColor = [UIColor blackColor]; 81 | 82 | NSString *sellStr = [NSString stringWithFormat:@"已售 %@ 件",self.showSales]; 83 | 84 | // NSDictionary*subStrAttribute = @{ 85 | // NSForegroundColorAttributeName: [UIColor redColor], 86 | // }; 87 | // NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:sellStr]; 88 | // [attributedText setAttributes:subStrAttribute range:NSMakeRange([sellStr rangeOfString:[self.showSales description]].location, [sellStr rangeOfString:[self.showSales description]].length)]; 89 | // //[attributedText setAttributes:subStrAttribute range:NSMakeRange(3, 2)]; 90 | // LB_showSales.attributedText = attributedText; 91 | //LB_showSales.text=sellStr; 92 | 93 | LB_showSales.font = [UIFont systemFontOfSize:13]; 94 | [whiteView addSubview:LB_showSales]; 95 | 96 | //用户所选择商品的尺码和颜色 97 | LB_detail = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(headImage.frame)+20, CGRectGetMaxY(LB_stock.frame), 150, 20)]; 98 | LB_detail.text = @"请选择 尺码 颜色分类"; 99 | LB_detail.numberOfLines = 0; 100 | LB_detail.textColor = [UIColor blackColor]; 101 | LB_detail.font = [UIFont systemFontOfSize:13]; 102 | [whiteView addSubview:LB_detail]; 103 | //分界线 104 | LB_line = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(headImage.frame)+10, screen_Width, 0.5)]; 105 | LB_line.backgroundColor = BackgroundColor; 106 | [whiteView addSubview:LB_line]; 107 | 108 | //加入购物车按钮 109 | addBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 110 | addBtn.frame = CGRectMake(0, whiteView.dwq_height-40, whiteView.frame.size.width/2, 40); 111 | 112 | [addBtn setBackgroundColor:SelectColor]; 113 | [addBtn setTitleColor:[UIColor whiteColor] forState:0]; 114 | addBtn.titleLabel.font = [UIFont systemFontOfSize:15]; 115 | [addBtn setTitle:@"加入购物车" forState:0]; 116 | [whiteView addSubview:addBtn]; 117 | 118 | //立即购买按钮 119 | buyBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 120 | buyBtn.frame = CGRectMake(whiteView.frame.size.width/2, whiteView.dwq_height-40, whiteView.frame.size.width/2, 40); 121 | [buyBtn setBackgroundColor:[UIColor colorWithRed:245/255.0f green:143/255.0f blue:43/255.0f alpha:1]]; 122 | [buyBtn setTitleColor:[UIColor whiteColor] forState:0]; 123 | buyBtn.titleLabel.font = [UIFont systemFontOfSize:15]; 124 | [buyBtn setTitle:@"立即购买" forState:0]; 125 | [whiteView addSubview:buyBtn]; 126 | 127 | //库存不足按钮 128 | stockBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 129 | stockBtn.frame = CGRectMake(0, whiteView.dwq_height-40, screen_Width, 40); 130 | [stockBtn setBackgroundColor:[UIColor lightGrayColor]]; 131 | [stockBtn setTitleColor:[UIColor blackColor] forState:0]; 132 | stockBtn.titleLabel.font = [UIFont systemFontOfSize:15]; 133 | [stockBtn setTitle:@"库存不足" forState:0]; 134 | [whiteView addSubview:stockBtn]; 135 | //默认隐藏 136 | stockBtn.hidden = YES; 137 | 138 | //有的商品尺码和颜色分类特别多 所以用UIScrollView 分类过多显示不全的时候可滑动查看 139 | mainscrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(headImage.frame)+10, screen_Width, whiteView.dwq_height-CGRectGetMaxY(headImage.frame)+10-60)]; 140 | mainscrollview.backgroundColor = [UIColor clearColor]; 141 | mainscrollview.contentSize = CGSizeMake(0, 200); 142 | mainscrollview.showsHorizontalScrollIndicator = NO; 143 | mainscrollview.showsVerticalScrollIndicator = NO; 144 | [whiteView addSubview:mainscrollview]; 145 | 146 | } 147 | 148 | 149 | 150 | 151 | 152 | @end 153 | -------------------------------------------------------------------------------- /DWQSelectAttributes/DWQSelectAttributesView/凯迪拉克.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevelopmentEngineer-DWQ/DWQSelectAttributes/2b3264117a2799dc109940c7d7f5069bf3e7b74c/DWQSelectAttributes/DWQSelectAttributesView/凯迪拉克.jpg -------------------------------------------------------------------------------- /DWQSelectAttributes/DWQSelectAttributesView/取消.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevelopmentEngineer-DWQ/DWQSelectAttributes/2b3264117a2799dc109940c7d7f5069bf3e7b74c/DWQSelectAttributes/DWQSelectAttributesView/取消.png -------------------------------------------------------------------------------- /DWQSelectAttributes/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | 38 | 39 | -------------------------------------------------------------------------------- /DWQSelectAttributes/PrefixHeader.pch: -------------------------------------------------------------------------------- 1 | // 2 | // PrefixHeader.pch 3 | // DWQSelectAttributes 4 | // 5 | // Created by 杜文全 on 15/5/21. 6 | // Copyright © 2015年 com.sdzw.duwenquan. All rights reserved. 7 | // 8 | 9 | #ifndef PrefixHeader_pch 10 | #define PrefixHeader_pch 11 | 12 | #import "UIView+DWQExtension.h" 13 | 14 | #define FONT(s) [UIFont systemFontOfSize:s] 15 | #define screen_Width [UIScreen mainScreen].bounds.size.width 16 | #define screen_Height [UIScreen mainScreen].bounds.size.height 17 | 18 | #define BackgroundColor [UIColor colorWithRed:240/255.0f green:240/255.0f blue:244/255.0f alpha:1] 19 | #define SelectColor [UIColor colorWithRed:60/255.0f green:0/255.0f blue:132/255.0f alpha:1] 20 | 21 | 22 | 23 | #endif /* PrefixHeader_pch */ 24 | -------------------------------------------------------------------------------- /DWQSelectAttributes/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // DWQSelectAttributes 4 | // 5 | // Created by 杜文全 on 15/5/21. 6 | // Copyright © 2015年 com.sdzw.duwenquan. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DWQSelectAttributes.h" 11 | #import "DWQSelectView.h" 12 | @interface ViewController : UIViewController 13 | @property(nonatomic,strong)DWQSelectView *selectView; 14 | @property(nonatomic,strong)DWQSelectAttributes *selectAttributes; 15 | 16 | @property(nonatomic,strong)NSMutableArray *attributesArray; 17 | 18 | @end 19 | 20 | -------------------------------------------------------------------------------- /DWQSelectAttributes/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // DWQSelectAttributes 4 | // 5 | // Created by 杜文全 on 15/5/21. 6 | // Copyright © 2015年 com.sdzw.duwenquan. All rights reserved. 7 | // 8 | #define screen_Width [UIScreen mainScreen].bounds.size.width 9 | #define screen_Height [UIScreen mainScreen].bounds.size.height 10 | #import "ViewController.h" 11 | 12 | @interface ViewController () 13 | 14 | @property(nonatomic,strong)UIView *backgroundView; 15 | 16 | @property(nonatomic,strong)NSArray *standardList; 17 | @property(nonatomic,strong)NSArray *standardValueList; 18 | 19 | @end 20 | 21 | @implementation ViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | [self createUI]; 26 | 27 | } 28 | -(void)createUI{ 29 | 30 | self.view.backgroundColor = [UIColor whiteColor]; 31 | 32 | self.backgroundView = [[UIView alloc] initWithFrame:self.view.bounds]; 33 | [self.view addSubview:self.backgroundView]; 34 | 35 | UIImageView *logo=[[UIImageView alloc]initWithFrame:CGRectMake(80, 80, screen_Width-160, 150)]; 36 | logo.image=[UIImage imageNamed:@"DWQ-LOGO.jpeg"]; 37 | 38 | [self.view addSubview:logo]; 39 | 40 | 41 | UILabel *JS=[[UILabel alloc]initWithFrame:CGRectMake(40, 260, screen_Width-40, 20)]; 42 | JS.text=@"简 书:iOS攻城狮DWQ"; 43 | JS.textColor=[UIColor redColor]; 44 | [self.view addSubview:JS]; 45 | 46 | UILabel *GitHub=[[UILabel alloc]initWithFrame:CGRectMake(40, 300, screen_Width-40, 20)]; 47 | GitHub.textColor=[UIColor blueColor]; 48 | GitHub.text=@"Github: DevelopmentEngineer-DWQ"; 49 | [self.view addSubview:GitHub]; 50 | 51 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; 52 | btn.frame = CGRectMake(0, screen_Height-40, screen_Width, 40); 53 | [btn setTitle:@"弹出规格框" forState:0]; 54 | [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 55 | btn.backgroundColor = [UIColor colorWithRed:245 green:56 blue:64 alpha:1]; 56 | [btn addTarget:self action:@selector(chooseViewClick) forControlEvents:UIControlEventTouchUpInside]; 57 | [self.view addSubview:btn]; 58 | 59 | 60 | self.standardList = @[@"颜色",@"尺寸"]; 61 | self.standardValueList = @[@[@"紫色",@"蓝色",@"灰色",@"黄黄",@"红色",@"青色",@"紫色",@"蓝色",@"灰色",@"黄黄",@"红色",@"绿色",@"白色",@"黑色"],@[@"s",@"m",@"l",@"xl",@"xxl",@"xxxl",@"xxxm",@"xxxxxxxxxxxx"]]; 62 | 63 | [self initSelectView]; 64 | } 65 | -(void)initSelectView{ 66 | 67 | self.selectView = [[DWQSelectView alloc] initWithFrame:CGRectMake(0, screen_Height, screen_Width, screen_Height)]; 68 | self.selectView.headImage.image = [UIImage imageNamed:@"凯迪拉克.jpg"]; 69 | self.selectView.LB_price.text = @"¥121.00"; 70 | self.selectView.LB_stock.text = [NSString stringWithFormat:@"库存%@件",@999]; 71 | self.selectView.LB_showSales.text=@"已销售40件"; 72 | self.selectView.LB_detail.text = @"请选择规格属性"; 73 | [self.view addSubview:self.selectView]; 74 | 75 | 76 | CGFloat maxY = 0; 77 | CGFloat height = 0; 78 | for (int i = 0; i < self.standardList.count; i ++) 79 | { 80 | 81 | self.selectAttributes = [[DWQSelectAttributes alloc] initWithTitle:self.standardList[i] titleArr:self.standardValueList[i] andFrame:CGRectMake(0, maxY, screen_Width, 40)]; 82 | maxY = CGRectGetMaxY(self.selectAttributes.frame); 83 | height += self.selectAttributes.dwq_height; 84 | self.selectAttributes.tag = 8000+i; 85 | self.selectAttributes.delegate = self; 86 | 87 | [self.selectView.mainscrollview addSubview:self.selectAttributes]; 88 | } 89 | self.selectView.mainscrollview.contentSize = CGSizeMake(0, height); 90 | 91 | //加入购物车按钮 92 | [self.selectView.addBtn addTarget:self action:@selector(addGoodsCartBtnClick) forControlEvents:UIControlEventTouchUpInside]; 93 | //立即购买 94 | [self.selectView.buyBtn addTarget:self action:@selector(addGoodsCartBtnClick) forControlEvents:UIControlEventTouchUpInside]; 95 | //取消按钮 96 | [self.selectView.cancelBtn addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside]; 97 | //点击黑色透明视图choseView会消失 98 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismiss)]; 99 | [self.selectView.alphaView addGestureRecognizer:tap]; 100 | } 101 | 102 | 103 | -(void)addGoodsCartBtnClick{ 104 | 105 | 106 | NSLog(@"立即购买成功"); 107 | } 108 | 109 | #pragma mark --弹出规格属性 110 | -(void)chooseViewClick{ 111 | NSLog(@"--------"); 112 | 113 | 114 | [UIView animateWithDuration: 0.35 animations: ^{ 115 | self.backgroundView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9); 116 | self.selectView.frame =CGRectMake(0, 0, screen_Width, screen_Height); 117 | } completion: nil]; 118 | 119 | } 120 | 121 | /** 122 | * 点击半透明部分或者取消按钮,弹出视图消失 123 | */ 124 | -(void)dismiss 125 | { 126 | // center.y = center.y+self.view.frame.size.height; 127 | [UIView animateWithDuration: 0.35 animations: ^{ 128 | self.selectView.frame =CGRectMake(0, screen_Height, screen_Width, screen_Height); 129 | self.backgroundView.transform = CGAffineTransformIdentity; 130 | } completion: nil]; 131 | 132 | } 133 | -(NSMutableArray *)attributesArray{ 134 | 135 | if (_attributesArray == nil) { 136 | 137 | _attributesArray = [[NSMutableArray alloc] init]; 138 | } 139 | return _attributesArray; 140 | } 141 | 142 | -(void)selectBtnTitle:(NSString *)title andBtn:(UIButton *)btn{ 143 | 144 | [self.attributesArray removeAllObjects]; 145 | 146 | for (int i=0; i < _standardList.count; i++) 147 | { 148 | DWQSelectAttributes *view = [self.view viewWithTag:8000+i]; 149 | 150 | for (UIButton *obj in view.btnView.subviews) 151 | { 152 | if(obj.selected){ 153 | 154 | for (NSArray *arr in self.standardValueList) 155 | { 156 | for (NSString *title in arr) { 157 | 158 | if ([view.selectBtn.titleLabel.text isEqualToString:title]) { 159 | 160 | [self.attributesArray addObject:view.selectBtn.titleLabel.text]; 161 | } 162 | } 163 | } 164 | } 165 | } 166 | } 167 | NSLog(@"%@",self.attributesArray); 168 | } 169 | 170 | 171 | 172 | 173 | @end 174 | -------------------------------------------------------------------------------- /DWQSelectAttributes/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DWQSelectAttributes 4 | // 5 | // Created by 杜文全 on 15/5/21. 6 | // Copyright © 2015年 com.sdzw.duwenquan. 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 | -------------------------------------------------------------------------------- /DWQSelectAttributesTests/DWQSelectAttributesTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // DWQSelectAttributesTests.m 3 | // DWQSelectAttributesTests 4 | // 5 | // Created by 杜文全 on 15/5/21. 6 | // Copyright © 2015年 com.sdzw.duwenquan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DWQSelectAttributesTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation DWQSelectAttributesTests 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 | -------------------------------------------------------------------------------- /DWQSelectAttributesTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | -------------------------------------------------------------------------------- /DWQSelectAttributesUITests/DWQSelectAttributesUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // DWQSelectAttributesUITests.m 3 | // DWQSelectAttributesUITests 4 | // 5 | // Created by 杜文全 on 15/5/21. 6 | // Copyright © 2015年 com.sdzw.duwenquan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DWQSelectAttributesUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation DWQSelectAttributesUITests 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 | -------------------------------------------------------------------------------- /DWQSelectAttributesUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 iOS高级攻城狮-杜文全 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 | # DWQSelectAttributes 2 | 购买页选择商品规格属性的封装,适用于电子商务平台 3 | ![DWQ-LOGO.jpeg](http://upload-images.jianshu.io/upload_images/2231137-d59fbfb131a93c52.jpeg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 4 | ##使用方法 5 | 6 |    1.将DWQSelectAttributesView和DWQExtension文件夹拖入到您的工程中,
7 |    2.在PCH文件中引入头文件:DWQSelectAttributes.h 8 | , DWQSelectView.h,UIView+DWQExtension.h
9 |     3.在需要使用规格属性选择空间的Controller中声明三个属性,代码示例如下 10 | ```objective-c 11 | @property(nonatomic,strong)DWQSelectView *selectView;//规格属性选择控件 12 | @property(nonatomic,strong)DWQSelectAttributes *selectAttributes; 13 | 14 | @property(nonatomic,strong)NSMutableArray *attributesArray; //属性数组 15 | ``` 16 |     4.在声明两个数组属性,其中一个未分类,另一个为分类下的规格,和一个背景控件,然后初始化需要传入的数组,数组格式如下: 17 | ```objective-c 18 | @property(nonatomic,strong)UIView *backgroundView; 19 | @property(nonatomic,strong)NSArray *standardList; 20 | @property(nonatomic,strong)NSArray *standardValueList; 21 | 22 | 23 | self.standardList = @[@"颜色",@"尺寸"]; 24 | self.standardValueList = @[@[@"紫色",@"蓝色",@"灰色",@"黄黄",@"红色",@"青色",@"紫色",@"蓝色",@"灰色",@"黄黄",@"红色",@"绿色",@"白色",@"黑色"],@[@"s",@"m",@"l",@"xl",@"xxl",@"xxxl",@"xxxm",@"xxxxxxxxxxxx"]]; 25 | 26 | ``` 27 |     5.然后在initSelectView,对其中的控件进行赋值。部分代码示例如下: 28 | ```onjective-c 29 | self.selectView = [[DWQSelectView alloc] initWithFrame:CGRectMake(0, screen_Height, screen_Width, screen_Height)]; 30 | self.selectView.headImage.image = [UIImage imageNamed:@"duwenquan"]; 31 | self.selectView.LB_price.text = @"¥121.00"; 32 | self.selectView.LB_stock.text = [NSString stringWithFormat:@"库存%@件",@999]; 33 | self.selectView.LB_showSales.text=@"已销售40件"; 34 | self.selectView.LB_detail.text = @"请选择规格属性"; 35 | [self.view addSubview:self.selectView]; 36 | 37 | 38 | CGFloat maxY = 0; 39 | CGFloat height = 0; 40 | for (int i = 0; i < self.standardList.count; i ++) 41 | { 42 | 43 | self.selectAttributes = [[DWQSelectAttributes alloc] initWithTitle:self.standardList[i] titleArr:self.standardValueList[i] andFrame:CGRectMake(0, maxY, screen_Width, 40)]; 44 | maxY = CGRectGetMaxY(self.selectAttributes.frame); 45 | height += self.selectAttributes.dwq_height; 46 | self.selectAttributes.tag = 8000+i; 47 | self.selectAttributes.delegate = self; 48 | 49 | [self.selectView.mainscrollview addSubview:self.selectAttributes]; 50 | } 51 | self.selectView.mainscrollview.contentSize = CGSizeMake(0, height); 52 | 53 | //加入购物车按钮 54 | [self.selectView.addBtn addTarget:self action:@selector(addGoodsCartBtnClick) forControlEvents:UIControlEventTouchUpInside]; 55 | //立即购买 56 | [self.selectView.buyBtn addTarget:self action:@selector(addGoodsCartBtnClick) forControlEvents:UIControlEventTouchUpInside]; 57 | //取消按钮 58 | [self.selectView.cancelBtn addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside]; 59 | //点击黑色透明视图choseView会消失 60 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismiss)]; 61 | [self.selectView.alphaView addGestureRecognizer:tap]; 62 | ``` 63 |     6.然后根据自己的需要来修改代码。一般需要重写的也就下面这个方法,这需要根据自己Model来针对性的进行修改,具体使用方式,查看Demo即可。 64 | ```objective-c 65 | -(void)selectBtnTitle:(NSString *)title andBtn:(UIButton *)btn 66 | ``` 67 |    7.效果图如下 68 | 69 | 70 | ![规格属性选择器.gif](http://upload-images.jianshu.io/upload_images/2231137-2bdeb61dec95e689.gif?imageMogr2/auto-orient/strip) 71 | --------------------------------------------------------------------------------