├── .DS_Store ├── README.md ├── iOS常见控件的封装.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── zhangjian.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── zhangjian.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── iOS常见控件的封装.xcscheme │ └── xcschememanagement.plist ├── iOS常见控件的封装 ├── .DS_Store ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Category │ ├── Common.pch │ ├── UIAlertController+Category.h │ ├── UIAlertController+Category.m │ ├── UIButton+Block.h │ ├── UIButton+Block.m │ ├── UILabel+Category.h │ ├── UILabel+Category.m │ ├── UIViewExt.h │ └── UIViewExt.m ├── Info.plist ├── ViewController.h ├── ViewController.m ├── iOS_______.xcdatamodeld │ ├── .xccurrentversion │ └── iOS_______.xcdatamodel │ │ └── contents └── main.m ├── iOS常见控件的封装Tests ├── Info.plist └── iOS_______Tests.m └── iOS常见控件的封装UITests ├── Info.plist └── iOS_______UITests.m /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaricleZhang/ControlsPackage/ba51f29302a8bb3ab8f193d9f79a1929e22297d5/.DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ControlsPackage 2 | iOS常见控件的封装 3 | -------------------------------------------------------------------------------- /iOS常见控件的封装.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 021235831DB627D80002E5E1 /* UILabel+Category.m in Sources */ = {isa = PBXBuildFile; fileRef = 021235821DB627D80002E5E1 /* UILabel+Category.m */; }; 11 | 021235861DB74F8F0002E5E1 /* UIViewExt.m in Sources */ = {isa = PBXBuildFile; fileRef = 021235851DB74F8F0002E5E1 /* UIViewExt.m */; }; 12 | 02935FFD1DB4F68D00574B46 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 02935FFC1DB4F68D00574B46 /* main.m */; }; 13 | 029360001DB4F68D00574B46 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 02935FFF1DB4F68D00574B46 /* AppDelegate.m */; }; 14 | 029360031DB4F68D00574B46 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 029360021DB4F68D00574B46 /* ViewController.m */; }; 15 | 029360061DB4F68D00574B46 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 029360041DB4F68D00574B46 /* Main.storyboard */; }; 16 | 029360091DB4F68D00574B46 /* iOS_______.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 029360071DB4F68D00574B46 /* iOS_______.xcdatamodeld */; }; 17 | 0293600B1DB4F68D00574B46 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0293600A1DB4F68D00574B46 /* Assets.xcassets */; }; 18 | 0293600E1DB4F68D00574B46 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0293600C1DB4F68D00574B46 /* LaunchScreen.storyboard */; }; 19 | 029360191DB4F68D00574B46 /* iOS_______Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 029360181DB4F68D00574B46 /* iOS_______Tests.m */; }; 20 | 029360241DB4F68D00574B46 /* iOS_______UITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 029360231DB4F68D00574B46 /* iOS_______UITests.m */; }; 21 | 029360341DB4F6B200574B46 /* UIButton+Block.m in Sources */ = {isa = PBXBuildFile; fileRef = 029360331DB4F6B200574B46 /* UIButton+Block.m */; }; 22 | 029E00591DBD8D480056DEE2 /* UIAlertController+Category.m in Sources */ = {isa = PBXBuildFile; fileRef = 029E00581DBD8D480056DEE2 /* UIAlertController+Category.m */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | 029360151DB4F68D00574B46 /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = 02935FF01DB4F68D00574B46 /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = 02935FF71DB4F68D00574B46; 31 | remoteInfo = "iOS常见控件的封装"; 32 | }; 33 | 029360201DB4F68D00574B46 /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = 02935FF01DB4F68D00574B46 /* Project object */; 36 | proxyType = 1; 37 | remoteGlobalIDString = 02935FF71DB4F68D00574B46; 38 | remoteInfo = "iOS常见控件的封装"; 39 | }; 40 | /* End PBXContainerItemProxy section */ 41 | 42 | /* Begin PBXFileReference section */ 43 | 021235811DB627D80002E5E1 /* UILabel+Category.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+Category.h"; sourceTree = ""; }; 44 | 021235821DB627D80002E5E1 /* UILabel+Category.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+Category.m"; sourceTree = ""; }; 45 | 021235841DB74F8F0002E5E1 /* UIViewExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIViewExt.h; sourceTree = ""; }; 46 | 021235851DB74F8F0002E5E1 /* UIViewExt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIViewExt.m; sourceTree = ""; }; 47 | 02935FF81DB4F68D00574B46 /* iOS常见控件的封装.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS常见控件的封装.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 02935FFC1DB4F68D00574B46 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 49 | 02935FFE1DB4F68D00574B46 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 50 | 02935FFF1DB4F68D00574B46 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 51 | 029360011DB4F68D00574B46 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 52 | 029360021DB4F68D00574B46 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 53 | 029360051DB4F68D00574B46 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 54 | 029360081DB4F68D00574B46 /* iOS_______.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "iOS_______.xcdatamodel"; sourceTree = ""; }; 55 | 0293600A1DB4F68D00574B46 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 56 | 0293600D1DB4F68D00574B46 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 57 | 0293600F1DB4F68D00574B46 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | 029360141DB4F68D00574B46 /* iOS常见控件的封装Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "iOS常见控件的封装Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 029360181DB4F68D00574B46 /* iOS_______Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "iOS_______Tests.m"; sourceTree = ""; }; 60 | 0293601A1DB4F68D00574B46 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 61 | 0293601F1DB4F68D00574B46 /* iOS常见控件的封装UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "iOS常见控件的封装UITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | 029360231DB4F68D00574B46 /* iOS_______UITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "iOS_______UITests.m"; sourceTree = ""; }; 63 | 029360251DB4F68D00574B46 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 64 | 029360321DB4F6B200574B46 /* UIButton+Block.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+Block.h"; sourceTree = ""; }; 65 | 029360331DB4F6B200574B46 /* UIButton+Block.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+Block.m"; sourceTree = ""; }; 66 | 029E00421DB7CCBA0056DEE2 /* Common.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Common.pch; sourceTree = ""; }; 67 | 029E00571DBD8D480056DEE2 /* UIAlertController+Category.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIAlertController+Category.h"; sourceTree = ""; }; 68 | 029E00581DBD8D480056DEE2 /* UIAlertController+Category.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIAlertController+Category.m"; sourceTree = ""; }; 69 | /* End PBXFileReference section */ 70 | 71 | /* Begin PBXFrameworksBuildPhase section */ 72 | 02935FF51DB4F68D00574B46 /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | 029360111DB4F68D00574B46 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | ); 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | 0293601C1DB4F68D00574B46 /* Frameworks */ = { 87 | isa = PBXFrameworksBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | ); 91 | runOnlyForDeploymentPostprocessing = 0; 92 | }; 93 | /* End PBXFrameworksBuildPhase section */ 94 | 95 | /* Begin PBXGroup section */ 96 | 02935FEF1DB4F68D00574B46 = { 97 | isa = PBXGroup; 98 | children = ( 99 | 02935FFA1DB4F68D00574B46 /* iOS常见控件的封装 */, 100 | 029360171DB4F68D00574B46 /* iOS常见控件的封装Tests */, 101 | 029360221DB4F68D00574B46 /* iOS常见控件的封装UITests */, 102 | 02935FF91DB4F68D00574B46 /* Products */, 103 | ); 104 | sourceTree = ""; 105 | }; 106 | 02935FF91DB4F68D00574B46 /* Products */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 02935FF81DB4F68D00574B46 /* iOS常见控件的封装.app */, 110 | 029360141DB4F68D00574B46 /* iOS常见控件的封装Tests.xctest */, 111 | 0293601F1DB4F68D00574B46 /* iOS常见控件的封装UITests.xctest */, 112 | ); 113 | name = Products; 114 | sourceTree = ""; 115 | }; 116 | 02935FFA1DB4F68D00574B46 /* iOS常见控件的封装 */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 029360311DB4F6B200574B46 /* Category */, 120 | 02935FFE1DB4F68D00574B46 /* AppDelegate.h */, 121 | 02935FFF1DB4F68D00574B46 /* AppDelegate.m */, 122 | 029360011DB4F68D00574B46 /* ViewController.h */, 123 | 029360021DB4F68D00574B46 /* ViewController.m */, 124 | 029360041DB4F68D00574B46 /* Main.storyboard */, 125 | 0293600A1DB4F68D00574B46 /* Assets.xcassets */, 126 | 0293600C1DB4F68D00574B46 /* LaunchScreen.storyboard */, 127 | 0293600F1DB4F68D00574B46 /* Info.plist */, 128 | 029360071DB4F68D00574B46 /* iOS_______.xcdatamodeld */, 129 | 02935FFB1DB4F68D00574B46 /* Supporting Files */, 130 | ); 131 | path = "iOS常见控件的封装"; 132 | sourceTree = ""; 133 | }; 134 | 02935FFB1DB4F68D00574B46 /* Supporting Files */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 02935FFC1DB4F68D00574B46 /* main.m */, 138 | ); 139 | name = "Supporting Files"; 140 | sourceTree = ""; 141 | }; 142 | 029360171DB4F68D00574B46 /* iOS常见控件的封装Tests */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 029360181DB4F68D00574B46 /* iOS_______Tests.m */, 146 | 0293601A1DB4F68D00574B46 /* Info.plist */, 147 | ); 148 | path = "iOS常见控件的封装Tests"; 149 | sourceTree = ""; 150 | }; 151 | 029360221DB4F68D00574B46 /* iOS常见控件的封装UITests */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | 029360231DB4F68D00574B46 /* iOS_______UITests.m */, 155 | 029360251DB4F68D00574B46 /* Info.plist */, 156 | ); 157 | path = "iOS常见控件的封装UITests"; 158 | sourceTree = ""; 159 | }; 160 | 029360311DB4F6B200574B46 /* Category */ = { 161 | isa = PBXGroup; 162 | children = ( 163 | 029360321DB4F6B200574B46 /* UIButton+Block.h */, 164 | 029360331DB4F6B200574B46 /* UIButton+Block.m */, 165 | 021235811DB627D80002E5E1 /* UILabel+Category.h */, 166 | 021235821DB627D80002E5E1 /* UILabel+Category.m */, 167 | 021235841DB74F8F0002E5E1 /* UIViewExt.h */, 168 | 021235851DB74F8F0002E5E1 /* UIViewExt.m */, 169 | 029E00571DBD8D480056DEE2 /* UIAlertController+Category.h */, 170 | 029E00581DBD8D480056DEE2 /* UIAlertController+Category.m */, 171 | 029E00421DB7CCBA0056DEE2 /* Common.pch */, 172 | ); 173 | path = Category; 174 | sourceTree = ""; 175 | }; 176 | /* End PBXGroup section */ 177 | 178 | /* Begin PBXNativeTarget section */ 179 | 02935FF71DB4F68D00574B46 /* iOS常见控件的封装 */ = { 180 | isa = PBXNativeTarget; 181 | buildConfigurationList = 029360281DB4F68D00574B46 /* Build configuration list for PBXNativeTarget "iOS常见控件的封装" */; 182 | buildPhases = ( 183 | 02935FF41DB4F68D00574B46 /* Sources */, 184 | 02935FF51DB4F68D00574B46 /* Frameworks */, 185 | 02935FF61DB4F68D00574B46 /* Resources */, 186 | ); 187 | buildRules = ( 188 | ); 189 | dependencies = ( 190 | ); 191 | name = "iOS常见控件的封装"; 192 | productName = "iOS常见控件的封装"; 193 | productReference = 02935FF81DB4F68D00574B46 /* iOS常见控件的封装.app */; 194 | productType = "com.apple.product-type.application"; 195 | }; 196 | 029360131DB4F68D00574B46 /* iOS常见控件的封装Tests */ = { 197 | isa = PBXNativeTarget; 198 | buildConfigurationList = 0293602B1DB4F68D00574B46 /* Build configuration list for PBXNativeTarget "iOS常见控件的封装Tests" */; 199 | buildPhases = ( 200 | 029360101DB4F68D00574B46 /* Sources */, 201 | 029360111DB4F68D00574B46 /* Frameworks */, 202 | 029360121DB4F68D00574B46 /* Resources */, 203 | ); 204 | buildRules = ( 205 | ); 206 | dependencies = ( 207 | 029360161DB4F68D00574B46 /* PBXTargetDependency */, 208 | ); 209 | name = "iOS常见控件的封装Tests"; 210 | productName = "iOS常见控件的封装Tests"; 211 | productReference = 029360141DB4F68D00574B46 /* iOS常见控件的封装Tests.xctest */; 212 | productType = "com.apple.product-type.bundle.unit-test"; 213 | }; 214 | 0293601E1DB4F68D00574B46 /* iOS常见控件的封装UITests */ = { 215 | isa = PBXNativeTarget; 216 | buildConfigurationList = 0293602E1DB4F68D00574B46 /* Build configuration list for PBXNativeTarget "iOS常见控件的封装UITests" */; 217 | buildPhases = ( 218 | 0293601B1DB4F68D00574B46 /* Sources */, 219 | 0293601C1DB4F68D00574B46 /* Frameworks */, 220 | 0293601D1DB4F68D00574B46 /* Resources */, 221 | ); 222 | buildRules = ( 223 | ); 224 | dependencies = ( 225 | 029360211DB4F68D00574B46 /* PBXTargetDependency */, 226 | ); 227 | name = "iOS常见控件的封装UITests"; 228 | productName = "iOS常见控件的封装UITests"; 229 | productReference = 0293601F1DB4F68D00574B46 /* iOS常见控件的封装UITests.xctest */; 230 | productType = "com.apple.product-type.bundle.ui-testing"; 231 | }; 232 | /* End PBXNativeTarget section */ 233 | 234 | /* Begin PBXProject section */ 235 | 02935FF01DB4F68D00574B46 /* Project object */ = { 236 | isa = PBXProject; 237 | attributes = { 238 | LastUpgradeCheck = 0800; 239 | ORGANIZATIONNAME = "张建"; 240 | TargetAttributes = { 241 | 02935FF71DB4F68D00574B46 = { 242 | CreatedOnToolsVersion = 8.0; 243 | DevelopmentTeam = C69KXLDX73; 244 | ProvisioningStyle = Automatic; 245 | }; 246 | 029360131DB4F68D00574B46 = { 247 | CreatedOnToolsVersion = 8.0; 248 | DevelopmentTeam = C69KXLDX73; 249 | ProvisioningStyle = Automatic; 250 | TestTargetID = 02935FF71DB4F68D00574B46; 251 | }; 252 | 0293601E1DB4F68D00574B46 = { 253 | CreatedOnToolsVersion = 8.0; 254 | DevelopmentTeam = C69KXLDX73; 255 | ProvisioningStyle = Automatic; 256 | TestTargetID = 02935FF71DB4F68D00574B46; 257 | }; 258 | }; 259 | }; 260 | buildConfigurationList = 02935FF31DB4F68D00574B46 /* Build configuration list for PBXProject "iOS常见控件的封装" */; 261 | compatibilityVersion = "Xcode 3.2"; 262 | developmentRegion = English; 263 | hasScannedForEncodings = 0; 264 | knownRegions = ( 265 | en, 266 | Base, 267 | ); 268 | mainGroup = 02935FEF1DB4F68D00574B46; 269 | productRefGroup = 02935FF91DB4F68D00574B46 /* Products */; 270 | projectDirPath = ""; 271 | projectRoot = ""; 272 | targets = ( 273 | 02935FF71DB4F68D00574B46 /* iOS常见控件的封装 */, 274 | 029360131DB4F68D00574B46 /* iOS常见控件的封装Tests */, 275 | 0293601E1DB4F68D00574B46 /* iOS常见控件的封装UITests */, 276 | ); 277 | }; 278 | /* End PBXProject section */ 279 | 280 | /* Begin PBXResourcesBuildPhase section */ 281 | 02935FF61DB4F68D00574B46 /* Resources */ = { 282 | isa = PBXResourcesBuildPhase; 283 | buildActionMask = 2147483647; 284 | files = ( 285 | 0293600E1DB4F68D00574B46 /* LaunchScreen.storyboard in Resources */, 286 | 0293600B1DB4F68D00574B46 /* Assets.xcassets in Resources */, 287 | 029360061DB4F68D00574B46 /* Main.storyboard in Resources */, 288 | ); 289 | runOnlyForDeploymentPostprocessing = 0; 290 | }; 291 | 029360121DB4F68D00574B46 /* Resources */ = { 292 | isa = PBXResourcesBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | ); 296 | runOnlyForDeploymentPostprocessing = 0; 297 | }; 298 | 0293601D1DB4F68D00574B46 /* Resources */ = { 299 | isa = PBXResourcesBuildPhase; 300 | buildActionMask = 2147483647; 301 | files = ( 302 | ); 303 | runOnlyForDeploymentPostprocessing = 0; 304 | }; 305 | /* End PBXResourcesBuildPhase section */ 306 | 307 | /* Begin PBXSourcesBuildPhase section */ 308 | 02935FF41DB4F68D00574B46 /* Sources */ = { 309 | isa = PBXSourcesBuildPhase; 310 | buildActionMask = 2147483647; 311 | files = ( 312 | 021235861DB74F8F0002E5E1 /* UIViewExt.m in Sources */, 313 | 029360031DB4F68D00574B46 /* ViewController.m in Sources */, 314 | 029E00591DBD8D480056DEE2 /* UIAlertController+Category.m in Sources */, 315 | 029360341DB4F6B200574B46 /* UIButton+Block.m in Sources */, 316 | 029360001DB4F68D00574B46 /* AppDelegate.m in Sources */, 317 | 02935FFD1DB4F68D00574B46 /* main.m in Sources */, 318 | 021235831DB627D80002E5E1 /* UILabel+Category.m in Sources */, 319 | 029360091DB4F68D00574B46 /* iOS_______.xcdatamodeld in Sources */, 320 | ); 321 | runOnlyForDeploymentPostprocessing = 0; 322 | }; 323 | 029360101DB4F68D00574B46 /* Sources */ = { 324 | isa = PBXSourcesBuildPhase; 325 | buildActionMask = 2147483647; 326 | files = ( 327 | 029360191DB4F68D00574B46 /* iOS_______Tests.m in Sources */, 328 | ); 329 | runOnlyForDeploymentPostprocessing = 0; 330 | }; 331 | 0293601B1DB4F68D00574B46 /* Sources */ = { 332 | isa = PBXSourcesBuildPhase; 333 | buildActionMask = 2147483647; 334 | files = ( 335 | 029360241DB4F68D00574B46 /* iOS_______UITests.m in Sources */, 336 | ); 337 | runOnlyForDeploymentPostprocessing = 0; 338 | }; 339 | /* End PBXSourcesBuildPhase section */ 340 | 341 | /* Begin PBXTargetDependency section */ 342 | 029360161DB4F68D00574B46 /* PBXTargetDependency */ = { 343 | isa = PBXTargetDependency; 344 | target = 02935FF71DB4F68D00574B46 /* iOS常见控件的封装 */; 345 | targetProxy = 029360151DB4F68D00574B46 /* PBXContainerItemProxy */; 346 | }; 347 | 029360211DB4F68D00574B46 /* PBXTargetDependency */ = { 348 | isa = PBXTargetDependency; 349 | target = 02935FF71DB4F68D00574B46 /* iOS常见控件的封装 */; 350 | targetProxy = 029360201DB4F68D00574B46 /* PBXContainerItemProxy */; 351 | }; 352 | /* End PBXTargetDependency section */ 353 | 354 | /* Begin PBXVariantGroup section */ 355 | 029360041DB4F68D00574B46 /* Main.storyboard */ = { 356 | isa = PBXVariantGroup; 357 | children = ( 358 | 029360051DB4F68D00574B46 /* Base */, 359 | ); 360 | name = Main.storyboard; 361 | sourceTree = ""; 362 | }; 363 | 0293600C1DB4F68D00574B46 /* LaunchScreen.storyboard */ = { 364 | isa = PBXVariantGroup; 365 | children = ( 366 | 0293600D1DB4F68D00574B46 /* Base */, 367 | ); 368 | name = LaunchScreen.storyboard; 369 | sourceTree = ""; 370 | }; 371 | /* End PBXVariantGroup section */ 372 | 373 | /* Begin XCBuildConfiguration section */ 374 | 029360261DB4F68D00574B46 /* Debug */ = { 375 | isa = XCBuildConfiguration; 376 | buildSettings = { 377 | ALWAYS_SEARCH_USER_PATHS = NO; 378 | CLANG_ANALYZER_NONNULL = YES; 379 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 380 | CLANG_CXX_LIBRARY = "libc++"; 381 | CLANG_ENABLE_MODULES = YES; 382 | CLANG_ENABLE_OBJC_ARC = YES; 383 | CLANG_WARN_BOOL_CONVERSION = YES; 384 | CLANG_WARN_CONSTANT_CONVERSION = YES; 385 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 386 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 387 | CLANG_WARN_EMPTY_BODY = YES; 388 | CLANG_WARN_ENUM_CONVERSION = YES; 389 | CLANG_WARN_INFINITE_RECURSION = YES; 390 | CLANG_WARN_INT_CONVERSION = YES; 391 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 392 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 393 | CLANG_WARN_UNREACHABLE_CODE = YES; 394 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 395 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 396 | COPY_PHASE_STRIP = NO; 397 | DEBUG_INFORMATION_FORMAT = dwarf; 398 | ENABLE_STRICT_OBJC_MSGSEND = YES; 399 | ENABLE_TESTABILITY = YES; 400 | GCC_C_LANGUAGE_STANDARD = gnu99; 401 | GCC_DYNAMIC_NO_PIC = NO; 402 | GCC_NO_COMMON_BLOCKS = YES; 403 | GCC_OPTIMIZATION_LEVEL = 0; 404 | GCC_PREPROCESSOR_DEFINITIONS = ( 405 | "DEBUG=1", 406 | "$(inherited)", 407 | ); 408 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 409 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 410 | GCC_WARN_UNDECLARED_SELECTOR = YES; 411 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 412 | GCC_WARN_UNUSED_FUNCTION = YES; 413 | GCC_WARN_UNUSED_VARIABLE = YES; 414 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 415 | MTL_ENABLE_DEBUG_INFO = YES; 416 | ONLY_ACTIVE_ARCH = YES; 417 | SDKROOT = iphoneos; 418 | TARGETED_DEVICE_FAMILY = "1,2"; 419 | }; 420 | name = Debug; 421 | }; 422 | 029360271DB4F68D00574B46 /* Release */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | ALWAYS_SEARCH_USER_PATHS = NO; 426 | CLANG_ANALYZER_NONNULL = YES; 427 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 428 | CLANG_CXX_LIBRARY = "libc++"; 429 | CLANG_ENABLE_MODULES = YES; 430 | CLANG_ENABLE_OBJC_ARC = YES; 431 | CLANG_WARN_BOOL_CONVERSION = YES; 432 | CLANG_WARN_CONSTANT_CONVERSION = YES; 433 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 434 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 435 | CLANG_WARN_EMPTY_BODY = YES; 436 | CLANG_WARN_ENUM_CONVERSION = YES; 437 | CLANG_WARN_INFINITE_RECURSION = YES; 438 | CLANG_WARN_INT_CONVERSION = YES; 439 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 440 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 441 | CLANG_WARN_UNREACHABLE_CODE = YES; 442 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 443 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 444 | COPY_PHASE_STRIP = NO; 445 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 446 | ENABLE_NS_ASSERTIONS = NO; 447 | ENABLE_STRICT_OBJC_MSGSEND = YES; 448 | GCC_C_LANGUAGE_STANDARD = gnu99; 449 | GCC_NO_COMMON_BLOCKS = YES; 450 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 451 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 452 | GCC_WARN_UNDECLARED_SELECTOR = YES; 453 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 454 | GCC_WARN_UNUSED_FUNCTION = YES; 455 | GCC_WARN_UNUSED_VARIABLE = YES; 456 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 457 | MTL_ENABLE_DEBUG_INFO = NO; 458 | SDKROOT = iphoneos; 459 | TARGETED_DEVICE_FAMILY = "1,2"; 460 | VALIDATE_PRODUCT = YES; 461 | }; 462 | name = Release; 463 | }; 464 | 029360291DB4F68D00574B46 /* Debug */ = { 465 | isa = XCBuildConfiguration; 466 | buildSettings = { 467 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 468 | DEVELOPMENT_TEAM = C69KXLDX73; 469 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 470 | GCC_PREFIX_HEADER = "iOS常见控件的封装/Category/Common.pch"; 471 | INFOPLIST_FILE = "iOS常见控件的封装/Info.plist"; 472 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 473 | PRODUCT_BUNDLE_IDENTIFIER = "com.zhangjian.cocoapods.iOS-------"; 474 | PRODUCT_NAME = "$(TARGET_NAME)"; 475 | }; 476 | name = Debug; 477 | }; 478 | 0293602A1DB4F68D00574B46 /* Release */ = { 479 | isa = XCBuildConfiguration; 480 | buildSettings = { 481 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 482 | DEVELOPMENT_TEAM = C69KXLDX73; 483 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 484 | GCC_PREFIX_HEADER = "iOS常见控件的封装/Category/Common.pch"; 485 | INFOPLIST_FILE = "iOS常见控件的封装/Info.plist"; 486 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 487 | PRODUCT_BUNDLE_IDENTIFIER = "com.zhangjian.cocoapods.iOS-------"; 488 | PRODUCT_NAME = "$(TARGET_NAME)"; 489 | }; 490 | name = Release; 491 | }; 492 | 0293602C1DB4F68D00574B46 /* Debug */ = { 493 | isa = XCBuildConfiguration; 494 | buildSettings = { 495 | BUNDLE_LOADER = "$(TEST_HOST)"; 496 | DEVELOPMENT_TEAM = C69KXLDX73; 497 | INFOPLIST_FILE = "iOS常见控件的封装Tests/Info.plist"; 498 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 499 | PRODUCT_BUNDLE_IDENTIFIER = "com.zhangjian.cocoapods.iOS-------Tests"; 500 | PRODUCT_NAME = "$(TARGET_NAME)"; 501 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOS常见控件的封装.app/iOS常见控件的封装"; 502 | }; 503 | name = Debug; 504 | }; 505 | 0293602D1DB4F68D00574B46 /* Release */ = { 506 | isa = XCBuildConfiguration; 507 | buildSettings = { 508 | BUNDLE_LOADER = "$(TEST_HOST)"; 509 | DEVELOPMENT_TEAM = C69KXLDX73; 510 | INFOPLIST_FILE = "iOS常见控件的封装Tests/Info.plist"; 511 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 512 | PRODUCT_BUNDLE_IDENTIFIER = "com.zhangjian.cocoapods.iOS-------Tests"; 513 | PRODUCT_NAME = "$(TARGET_NAME)"; 514 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOS常见控件的封装.app/iOS常见控件的封装"; 515 | }; 516 | name = Release; 517 | }; 518 | 0293602F1DB4F68D00574B46 /* Debug */ = { 519 | isa = XCBuildConfiguration; 520 | buildSettings = { 521 | DEVELOPMENT_TEAM = C69KXLDX73; 522 | INFOPLIST_FILE = "iOS常见控件的封装UITests/Info.plist"; 523 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 524 | PRODUCT_BUNDLE_IDENTIFIER = "com.zhangjian.cocoapods.iOS-------UITests"; 525 | PRODUCT_NAME = "$(TARGET_NAME)"; 526 | TEST_TARGET_NAME = "iOS常见控件的封装"; 527 | }; 528 | name = Debug; 529 | }; 530 | 029360301DB4F68D00574B46 /* Release */ = { 531 | isa = XCBuildConfiguration; 532 | buildSettings = { 533 | DEVELOPMENT_TEAM = C69KXLDX73; 534 | INFOPLIST_FILE = "iOS常见控件的封装UITests/Info.plist"; 535 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 536 | PRODUCT_BUNDLE_IDENTIFIER = "com.zhangjian.cocoapods.iOS-------UITests"; 537 | PRODUCT_NAME = "$(TARGET_NAME)"; 538 | TEST_TARGET_NAME = "iOS常见控件的封装"; 539 | }; 540 | name = Release; 541 | }; 542 | /* End XCBuildConfiguration section */ 543 | 544 | /* Begin XCConfigurationList section */ 545 | 02935FF31DB4F68D00574B46 /* Build configuration list for PBXProject "iOS常见控件的封装" */ = { 546 | isa = XCConfigurationList; 547 | buildConfigurations = ( 548 | 029360261DB4F68D00574B46 /* Debug */, 549 | 029360271DB4F68D00574B46 /* Release */, 550 | ); 551 | defaultConfigurationIsVisible = 0; 552 | defaultConfigurationName = Release; 553 | }; 554 | 029360281DB4F68D00574B46 /* Build configuration list for PBXNativeTarget "iOS常见控件的封装" */ = { 555 | isa = XCConfigurationList; 556 | buildConfigurations = ( 557 | 029360291DB4F68D00574B46 /* Debug */, 558 | 0293602A1DB4F68D00574B46 /* Release */, 559 | ); 560 | defaultConfigurationIsVisible = 0; 561 | defaultConfigurationName = Release; 562 | }; 563 | 0293602B1DB4F68D00574B46 /* Build configuration list for PBXNativeTarget "iOS常见控件的封装Tests" */ = { 564 | isa = XCConfigurationList; 565 | buildConfigurations = ( 566 | 0293602C1DB4F68D00574B46 /* Debug */, 567 | 0293602D1DB4F68D00574B46 /* Release */, 568 | ); 569 | defaultConfigurationIsVisible = 0; 570 | defaultConfigurationName = Release; 571 | }; 572 | 0293602E1DB4F68D00574B46 /* Build configuration list for PBXNativeTarget "iOS常见控件的封装UITests" */ = { 573 | isa = XCConfigurationList; 574 | buildConfigurations = ( 575 | 0293602F1DB4F68D00574B46 /* Debug */, 576 | 029360301DB4F68D00574B46 /* Release */, 577 | ); 578 | defaultConfigurationIsVisible = 0; 579 | defaultConfigurationName = Release; 580 | }; 581 | /* End XCConfigurationList section */ 582 | 583 | /* Begin XCVersionGroup section */ 584 | 029360071DB4F68D00574B46 /* iOS_______.xcdatamodeld */ = { 585 | isa = XCVersionGroup; 586 | children = ( 587 | 029360081DB4F68D00574B46 /* iOS_______.xcdatamodel */, 588 | ); 589 | currentVersion = 029360081DB4F68D00574B46 /* iOS_______.xcdatamodel */; 590 | path = "iOS_______.xcdatamodeld"; 591 | sourceTree = ""; 592 | versionGroupType = wrapper.xcdatamodel; 593 | }; 594 | /* End XCVersionGroup section */ 595 | }; 596 | rootObject = 02935FF01DB4F68D00574B46 /* Project object */; 597 | } 598 | -------------------------------------------------------------------------------- /iOS常见控件的封装.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iOS常见控件的封装.xcodeproj/project.xcworkspace/xcuserdata/zhangjian.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaricleZhang/ControlsPackage/ba51f29302a8bb3ab8f193d9f79a1929e22297d5/iOS常见控件的封装.xcodeproj/project.xcworkspace/xcuserdata/zhangjian.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /iOS常见控件的封装.xcodeproj/xcuserdata/zhangjian.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /iOS常见控件的封装.xcodeproj/xcuserdata/zhangjian.xcuserdatad/xcschemes/iOS常见控件的封装.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 89 | 90 | 91 | 92 | 93 | 94 | 100 | 102 | 108 | 109 | 110 | 111 | 113 | 114 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /iOS常见控件的封装.xcodeproj/xcuserdata/zhangjian.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | iOS常见控件的封装.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 02935FF71DB4F68D00574B46 16 | 17 | primary 18 | 19 | 20 | 029360131DB4F68D00574B46 21 | 22 | primary 23 | 24 | 25 | 0293601E1DB4F68D00574B46 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /iOS常见控件的封装/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaricleZhang/ControlsPackage/ba51f29302a8bb3ab8f193d9f79a1929e22297d5/iOS常见控件的封装/.DS_Store -------------------------------------------------------------------------------- /iOS常见控件的封装/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // iOS常见控件的封装 4 | // 5 | // Created by 张建 on 16/10/17. 6 | // Copyright © 2016年 张建. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (strong, nonatomic) UIWindow *window; 15 | 16 | @property (readonly, strong) NSPersistentContainer *persistentContainer; 17 | 18 | - (void)saveContext; 19 | 20 | 21 | @end 22 | 23 | -------------------------------------------------------------------------------- /iOS常见控件的封装/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // iOS常见控件的封装 4 | // 5 | // Created by 张建 on 16/10/17. 6 | // Copyright © 2016年 张建. 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 | // Saves changes in the application's managed object context before the application terminates. 49 | [self saveContext]; 50 | } 51 | 52 | 53 | #pragma mark - Core Data stack 54 | 55 | @synthesize persistentContainer = _persistentContainer; 56 | 57 | - (NSPersistentContainer *)persistentContainer { 58 | // The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it. 59 | @synchronized (self) { 60 | if (_persistentContainer == nil) { 61 | _persistentContainer = [[NSPersistentContainer alloc] initWithName:@"iOS_______"]; 62 | [_persistentContainer loadPersistentStoresWithCompletionHandler:^(NSPersistentStoreDescription *storeDescription, NSError *error) { 63 | if (error != nil) { 64 | // Replace this implementation with code to handle the error appropriately. 65 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 66 | 67 | /* 68 | Typical reasons for an error here include: 69 | * The parent directory does not exist, cannot be created, or disallows writing. 70 | * The persistent store is not accessible, due to permissions or data protection when the device is locked. 71 | * The device is out of space. 72 | * The store could not be migrated to the current model version. 73 | Check the error message to determine what the actual problem was. 74 | */ 75 | NSLog(@"Unresolved error %@, %@", error, error.userInfo); 76 | abort(); 77 | } 78 | }]; 79 | } 80 | } 81 | 82 | return _persistentContainer; 83 | } 84 | 85 | #pragma mark - Core Data Saving support 86 | 87 | - (void)saveContext { 88 | NSManagedObjectContext *context = self.persistentContainer.viewContext; 89 | NSError *error = nil; 90 | if ([context hasChanges] && ![context save:&error]) { 91 | // Replace this implementation with code to handle the error appropriately. 92 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 93 | NSLog(@"Unresolved error %@, %@", error, error.userInfo); 94 | abort(); 95 | } 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /iOS常见控件的封装/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 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /iOS常见控件的封装/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 | -------------------------------------------------------------------------------- /iOS常见控件的封装/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 | -------------------------------------------------------------------------------- /iOS常见控件的封装/Category/Common.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Common.pch 3 | // iOS常见控件的封装 4 | // 5 | // Created by 张建 on 16/10/19. 6 | // Copyright © 2016年 张建. All rights reserved. 7 | // 8 | 9 | #ifndef Common_pch 10 | #define Common_pch 11 | 12 | #import "UIViewExt.h" 13 | 14 | #endif /* Common_pch */ 15 | -------------------------------------------------------------------------------- /iOS常见控件的封装/Category/UIAlertController+Category.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIAlertController+Category.h 3 | // iOS常见控件的封装 4 | // 5 | // Created by 张建 on 16/10/24. 6 | // Copyright © 2016年 张建. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void (^CallBackBlock)(NSInteger btnIndex); 12 | 13 | @interface UIAlertController (Category) 14 | 15 | /** 16 | 自定义封装的UIAlertController方法 17 | 18 | @param viewController 显示的vc 19 | @param alertControllerStyle UIAlertControllerStyle 样式 20 | @param title 标题 21 | @param message 提示信息 22 | @param block 回调block 23 | @param cancelBtnTitle 取消button标题 24 | @param destructiveBtnTitle 红色的按钮 25 | @param otherBtnTitles 其他button标题 26 | */ 27 | + (void)showAlertCntrollerWithViewController:(UIViewController*)viewController alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle title:(NSString*)title message:(NSString*)message CallBackBlock:(CallBackBlock)block cancelButtonTitle:(NSString *)cancelBtnTitle 28 | destructiveButtonTitle:(NSString *)destructiveBtnTitle 29 | otherButtonTitles:(NSString *)otherBtnTitles,...NS_REQUIRES_NIL_TERMINATION; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /iOS常见控件的封装/Category/UIAlertController+Category.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIAlertController+Category.m 3 | // iOS常见控件的封装 4 | // 5 | // Created by 张建 on 16/10/24. 6 | // Copyright © 2016年 张建. All rights reserved. 7 | // 8 | 9 | #import "UIAlertController+Category.h" 10 | 11 | @implementation UIAlertController (Category) 12 | 13 | +(void)showAlertCntrollerWithViewController:(UIViewController *)viewController alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle title:(NSString *)title message:(NSString *)message CallBackBlock:(CallBackBlock)block cancelButtonTitle:(NSString *)cancelBtnTitle destructiveButtonTitle:(NSString *)destructiveBtnTitle otherButtonTitles:(NSString *)otherBtnTitles, ... 14 | { 15 | UIAlertController * alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:alertControllerStyle]; 16 | 17 | //添加按钮 18 | if (cancelBtnTitle.length) { 19 | UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:cancelBtnTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { 20 | block(0); 21 | }]; 22 | [alertController addAction:cancelAction]; 23 | } 24 | if (destructiveBtnTitle.length) { 25 | UIAlertAction * destructiveAction = [UIAlertAction actionWithTitle:destructiveBtnTitle style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { 26 | block(1); 27 | }]; 28 | [alertController addAction:destructiveAction]; 29 | } 30 | if (otherBtnTitles.length) { 31 | UIAlertAction *otherActions = [UIAlertAction actionWithTitle:otherBtnTitles style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { 32 | (!cancelBtnTitle.length && !destructiveBtnTitle.length) ? block(0) : (((cancelBtnTitle.length && !destructiveBtnTitle.length) || (!cancelBtnTitle.length && destructiveBtnTitle.length)) ? block(1) : block(2)); 33 | }]; 34 | [alertController addAction:otherActions]; 35 | /** 36 | * va_list : (1)首先在函数里定义一具VA_LIST型的变量,这个变量是指向参数的指针; 37 | * (2)然后用VA_START宏初始化变量刚定义的VA_LIST变量; 38 | * (3)然后用VA_ARG返回可变的参数,VA_ARG的第二个参数是你要返回的参数的类型(如果函数有多个可变参数的,依次调用VA_ARG获取各个参数); 39 | * (4)最后用VA_END宏结束可变参数的获取。 40 | * va_start :获取可变参数列表的第一个参数的地址; 41 | * va_arg :获取当前参数,返回指定类型并将指针指向下一参数 42 | * va_end :清空va_list可变参数列表: 43 | * 44 | * 45 | */ 46 | 47 | va_list args; 48 | va_start(args, otherBtnTitles); 49 | if (otherBtnTitles.length) { 50 | NSString * otherString; 51 | int index = 2; 52 | (!cancelBtnTitle.length && !destructiveBtnTitle.length) ? (index = 0) : ((cancelBtnTitle.length && !destructiveBtnTitle.length) || (!cancelBtnTitle.length && destructiveBtnTitle.length) ? (index = 1) : (index = 2)); 53 | while ((otherString = va_arg(args, NSString*))) { 54 | index ++ ; 55 | UIAlertAction * otherActions = [UIAlertAction actionWithTitle:otherString style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { 56 | block(index); 57 | }]; 58 | [alertController addAction:otherActions]; 59 | } 60 | } 61 | va_end(args); 62 | } 63 | [viewController presentViewController:alertController animated:YES completion:nil]; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /iOS常见控件的封装/Category/UIButton+Block.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+Block.h 3 | // iOS常见控件的安装 4 | // 5 | // Created by 张建 on 16/10/17. 6 | // Copyright © 2016年 张建. All rights reserved. 7 | // 8 | 9 | #import 10 | typedef void(^tapActionBlock)(UIButton *button); 11 | 12 | @interface UIButton (Block) 13 | @property(nonatomic,copy)tapActionBlock actionBlock; 14 | 15 | /** 16 | 通过block对button的点击事件封装 17 | 18 | @param frame frame 19 | @param title 标题 20 | @param bgImageName 背景图片 21 | @param actionBlock 点击事件回调block 22 | 23 | @return button 24 | */ 25 | + (UIButton *)createBtnFrame:(CGRect)frame title:(NSString *)title bgImageName:(NSString *)bgImageName action:(tapActionBlock)actionBlock; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /iOS常见控件的封装/Category/UIButton+Block.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+Block.m 3 | // iOS常见控件的安装 4 | // 5 | // Created by 张建 on 16/10/17. 6 | // Copyright © 2016年 张建. All rights reserved. 7 | // 8 | 9 | #import "UIButton+Block.h" 10 | #import 11 | 12 | @implementation UIButton (Block) 13 | static NSString *keyOfUseCategoryMethod;//用分类方法创建的button,关联对象的key 14 | static NSString *keyOfBlock; 15 | 16 | + (UIButton *)createBtnFrame:(CGRect)frame title:(NSString *)title bgImageName:(NSString *)bgImageName action:(tapActionBlock)actionBlock 17 | { 18 | 19 | UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 20 | button.frame = frame; 21 | [button setTitle:title forState:UIControlStateNormal]; 22 | [button setBackgroundImage:[UIImage imageNamed:bgImageName] forState:UIControlStateNormal]; 23 | [button addTarget:button action:@selector(tapAction:) forControlEvents:UIControlEventTouchUpInside]; 24 | 25 | /** 26 | *用runtime中的函数通过key关联对象 27 | * 28 | *objc_setAssociatedObject(id object, const void *key, id value, objc_AssociationPolicy policy) 29 | *id object 表示关联者,是一个对象,变量名理所当然也是object 30 | *const void *key 获取被关联者的索引key 31 | *id value 被关联者,这里是一个block 32 | *objc_AssociationPolicy policy 关联时采用的协议,有assign,retain,copy等协议,一般使用OBJC_ASSOCIATION_RETAIN_NONATOMIC 33 | 34 | */ 35 | objc_setAssociatedObject (button , &keyOfUseCategoryMethod , actionBlock, OBJC_ASSOCIATION_COPY_NONATOMIC ); 36 | 37 | return button; 38 | } 39 | - (void)tapAction:(UIButton*)sender 40 | { 41 | /** 42 | * 通过key获取被关联对象 43 | *objc_getAssociatedObject(id object, const void *key) 44 | * 45 | */ 46 | tapActionBlock block = ( tapActionBlock )objc_getAssociatedObject (sender , &keyOfUseCategoryMethod ); 47 | 48 | if (block) { 49 | 50 | block(sender); 51 | 52 | } 53 | } 54 | 55 | 56 | 57 | - (void)setActionBlock:(tapActionBlock)actionBlock 58 | { 59 | objc_setAssociatedObject (self , &keyOfBlock , actionBlock, OBJC_ASSOCIATION_COPY_NONATOMIC ); 60 | 61 | } 62 | 63 | - (tapActionBlock)actionBlock 64 | { 65 | return objc_getAssociatedObject (self , &keyOfBlock ); 66 | } 67 | 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /iOS常见控件的封装/Category/UILabel+Category.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+Category.h 3 | // iOS常见控件的封装 4 | // 5 | // Created by 张建 on 16/10/18. 6 | // Copyright © 2016年 张建. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UILabel (Category) 12 | 13 | /** 14 | 创建普通文本 15 | 16 | @param frame frame 17 | @param text 文字 18 | @param textColor 字体颜色 19 | @param textAlignment 字体位置 20 | @param font 字体大小 21 | 22 | @return label 23 | */ 24 | + (instancetype)createLabelWithFrame:(CGRect)frame text:(NSString *)text titleColor:(UIColor *)textColor textAlignment:(NSTextAlignment)textAlignment font:(UIFont *)font; 25 | 26 | 27 | /** 28 | 获取普通文本的高度 (影响普通文本高度的两个因素:1.最大宽度 2.字体大小) 29 | 30 | @param maxWidth 最大宽度限制 31 | 32 | @return label的高度 33 | */ 34 | - (CGFloat)getLabelHeightWithMaxWidth:(CGFloat)maxWidth; 35 | 36 | 37 | /** 38 | 获取富文本高度 (影响富文本高度的4个因素:1.最大宽度 2.字体大小 3.行间距 4.字间距 字间距一般不变,这里没有封装) 39 | 40 | @param text text 41 | @param maxWidth 最大宽度限制 42 | @param lineSpacing 行间距 43 | 44 | @return label的高度 45 | */ 46 | - (CGFloat)getAttributeLabelHeightWithText:(NSString*)text maxWidth:(CGFloat)maxWidth lineSpacing:(CGFloat)lineSpacing; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /iOS常见控件的封装/Category/UILabel+Category.m: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+Category.m 3 | // iOS常见控件的封装 4 | // 5 | // Created by 张建 on 16/10/18. 6 | // Copyright © 2016年 张建. All rights reserved. 7 | // 8 | 9 | #import "UILabel+Category.h" 10 | 11 | @implementation UILabel (Category) 12 | 13 | + (instancetype)createLabelWithFrame:(CGRect)frame text:(NSString *)text titleColor:(UIColor *)textColor textAlignment:(NSTextAlignment)textAlignment font:(UIFont *)font 14 | { 15 | UILabel *label = [[UILabel alloc]initWithFrame:frame]; 16 | label.text = text; 17 | label.textColor = textColor; 18 | label.textAlignment = textAlignment; 19 | label.font = font; 20 | 21 | return label; 22 | } 23 | 24 | - (CGFloat)getLabelHeightWithMaxWidth:(CGFloat)maxWidth 25 | { 26 | self.numberOfLines = 0; 27 | self.width = maxWidth; 28 | CGRect rect = [self.text boundingRectWithSize:CGSizeMake(maxWidth, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:self.font,} context:nil]; 29 | 30 | return rect.size.height; 31 | } 32 | 33 | -(CGFloat)getAttributeLabelHeightWithText:(NSString *)text maxWidth:(CGFloat)maxWidth lineSpacing:(CGFloat)lineSpacing 34 | { 35 | self.numberOfLines = 0; 36 | self.width = maxWidth; 37 | 38 | NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; 39 | 40 | [style setLineSpacing:lineSpacing]; 41 | 42 | CGRect rect = [text boundingRectWithSize:CGSizeMake(maxWidth, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:self.font,NSParagraphStyleAttributeName:style} context:nil]; 43 | 44 | return rect.size.height; 45 | 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /iOS常见控件的封装/Category/UIViewExt.h: -------------------------------------------------------------------------------- 1 | /* 2 | Erica Sadun, http://ericasadun.com 3 | iPhone Developer's Cookbook, 3.0 Edition 4 | BSD License, Use at your own risk 5 | */ 6 | 7 | #import 8 | 9 | CGRect CGRectScaleMake(CGFloat x ,CGFloat y , CGFloat width,CGFloat height); 10 | CGPoint CGRectGetCenter(CGRect rect); 11 | CGRect CGRectMoveToCenter(CGRect rect, CGPoint center); 12 | 13 | @interface UIView (ViewFrameGeometry) 14 | @property CGPoint origin; 15 | @property CGSize size; 16 | 17 | @property (readonly) CGPoint bottomLeft; 18 | @property (readonly) CGPoint bottomRight; 19 | @property (readonly) CGPoint topRight; 20 | 21 | @property CGFloat height; 22 | @property CGFloat width; 23 | 24 | @property CGFloat top; 25 | @property CGFloat left; 26 | 27 | @property CGFloat bottom; 28 | @property CGFloat right; 29 | 30 | - (void) moveBy: (CGPoint) delta; 31 | - (void) scaleBy: (CGFloat) scaleFactor; 32 | - (void) fitInSize: (CGSize) aSize; 33 | @end -------------------------------------------------------------------------------- /iOS常见控件的封装/Category/UIViewExt.m: -------------------------------------------------------------------------------- 1 | /* 2 | Erica Sadun, http://ericasadun.com 3 | iPhone Developer's Cookbook, 3.0 Edition 4 | BSD License, Use at your own risk 5 | */ 6 | 7 | #import "UIViewExt.h" 8 | 9 | 10 | CGPoint CGRectGetCenter(CGRect rect) 11 | { 12 | CGPoint pt; 13 | pt.x = CGRectGetMidX(rect); 14 | pt.y = CGRectGetMidY(rect); 15 | return pt; 16 | } 17 | 18 | CGRect CGRectMoveToCenter(CGRect rect, CGPoint center) 19 | { 20 | CGRect newrect = CGRectZero; 21 | newrect.origin.x = center.x-CGRectGetMidX(rect); 22 | newrect.origin.y = center.y-CGRectGetMidY(rect); 23 | newrect.size = rect.size; 24 | return newrect; 25 | } 26 | 27 | @implementation UIView (ViewGeometry) 28 | 29 | // Retrieve and set the origin 30 | - (CGPoint) origin 31 | { 32 | return self.frame.origin; 33 | } 34 | 35 | - (void) setOrigin: (CGPoint) aPoint 36 | { 37 | CGRect newframe = self.frame; 38 | newframe.origin = aPoint; 39 | self.frame = newframe; 40 | } 41 | 42 | 43 | // Retrieve and set the size 44 | - (CGSize) size 45 | { 46 | return self.frame.size; 47 | } 48 | 49 | - (void) setSize: (CGSize) aSize 50 | { 51 | CGRect newframe = self.frame; 52 | newframe.size = aSize; 53 | self.frame = newframe; 54 | } 55 | 56 | // Query other frame locations 57 | - (CGPoint) bottomRight 58 | { 59 | CGFloat x = self.frame.origin.x + self.frame.size.width; 60 | CGFloat y = self.frame.origin.y + self.frame.size.height; 61 | return CGPointMake(x, y); 62 | } 63 | 64 | - (CGPoint) bottomLeft 65 | { 66 | CGFloat x = self.frame.origin.x; 67 | CGFloat y = self.frame.origin.y + self.frame.size.height; 68 | return CGPointMake(x, y); 69 | } 70 | 71 | - (CGPoint) topRight 72 | { 73 | CGFloat x = self.frame.origin.x + self.frame.size.width; 74 | CGFloat y = self.frame.origin.y; 75 | return CGPointMake(x, y); 76 | } 77 | 78 | 79 | // Retrieve and set height, width, top, bottom, left, right 80 | - (CGFloat) height 81 | { 82 | return self.frame.size.height; 83 | } 84 | 85 | - (void) setHeight: (CGFloat) newheight 86 | { 87 | CGRect newframe = self.frame; 88 | newframe.size.height = newheight; 89 | self.frame = newframe; 90 | } 91 | 92 | - (CGFloat) width 93 | { 94 | return self.frame.size.width; 95 | } 96 | 97 | - (void) setWidth: (CGFloat) newwidth 98 | { 99 | CGRect newframe = self.frame; 100 | newframe.size.width = newwidth; 101 | self.frame = newframe; 102 | } 103 | 104 | - (CGFloat) top 105 | { 106 | return self.frame.origin.y; 107 | } 108 | 109 | - (void) setTop: (CGFloat) newtop 110 | { 111 | CGRect newframe = self.frame; 112 | newframe.origin.y = newtop; 113 | self.frame = newframe; 114 | } 115 | 116 | - (CGFloat) left 117 | { 118 | return self.frame.origin.x; 119 | } 120 | 121 | - (void) setLeft: (CGFloat) newleft 122 | { 123 | CGRect newframe = self.frame; 124 | newframe.origin.x = newleft; 125 | self.frame = newframe; 126 | } 127 | 128 | - (CGFloat) bottom 129 | { 130 | return self.frame.origin.y + self.frame.size.height; 131 | } 132 | 133 | - (void) setBottom: (CGFloat) newbottom 134 | { 135 | CGRect newframe = self.frame; 136 | newframe.origin.y = newbottom - self.frame.size.height; 137 | self.frame = newframe; 138 | } 139 | 140 | - (CGFloat) right 141 | { 142 | return self.frame.origin.x + self.frame.size.width; 143 | } 144 | 145 | - (void) setRight: (CGFloat) newright 146 | { 147 | CGFloat delta = newright - (self.frame.origin.x + self.frame.size.width); 148 | CGRect newframe = self.frame; 149 | newframe.origin.x += delta ; 150 | self.frame = newframe; 151 | } 152 | 153 | // Move via offset 154 | - (void) moveBy: (CGPoint) delta 155 | { 156 | CGPoint newcenter = self.center; 157 | newcenter.x += delta.x; 158 | newcenter.y += delta.y; 159 | self.center = newcenter; 160 | } 161 | 162 | // Scaling 163 | - (void) scaleBy: (CGFloat) scaleFactor 164 | { 165 | CGRect newframe = self.frame; 166 | newframe.size.width *= scaleFactor; 167 | newframe.size.height *= scaleFactor; 168 | self.frame = newframe; 169 | } 170 | 171 | // Ensure that both dimensions fit within the given size by scaling down 172 | - (void) fitInSize: (CGSize) aSize 173 | { 174 | CGFloat scale; 175 | CGRect newframe = self.frame; 176 | 177 | if (newframe.size.height && (newframe.size.height > aSize.height)) 178 | { 179 | scale = aSize.height / newframe.size.height; 180 | newframe.size.width *= scale; 181 | newframe.size.height *= scale; 182 | } 183 | 184 | if (newframe.size.width && (newframe.size.width >= aSize.width)) 185 | { 186 | scale = aSize.width / newframe.size.width; 187 | newframe.size.width *= scale; 188 | newframe.size.height *= scale; 189 | } 190 | 191 | self.frame = newframe; 192 | } 193 | @end -------------------------------------------------------------------------------- /iOS常见控件的封装/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 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /iOS常见控件的封装/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // iOS常见控件的封装 4 | // 5 | // Created by 张建 on 16/10/17. 6 | // Copyright © 2016年 张建. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /iOS常见控件的封装/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // iOS常见控件的封装 4 | // 5 | // Created by 张建 on 16/10/17. 6 | // Copyright © 2016年 张建. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "UIButton+Block.h" 11 | #import "UILabel+Category.h" 12 | #import "UIViewExt.h" 13 | #import "UIAlertController+Category.h" 14 | 15 | #define RGB(R,G,B) [UIColor colorWithRed:R green:G blue:B alpha:1.0] 16 | #define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width 17 | #define FontSize(_size_) [UIFont systemFontOfSize:_size_] 18 | 19 | @interface ViewController () 20 | @property(nonatomic,copy)NSString *str; 21 | 22 | @end 23 | 24 | @implementation ViewController 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | 29 | //按钮 30 | UIButton *button = [UIButton createBtnFrame:CGRectMake(100, 100,SCREEN_WIDTH - 2*100, 50) title:@"button" bgImageName:nil action:^(UIButton *button) { 31 | _str = @""; 32 | float r = random()%255/255.0; 33 | float g = random()%255/255.0; 34 | float b = random()%255/255.0; 35 | 36 | self.view.backgroundColor = RGB(r, g, b); 37 | [UIAlertController showAlertCntrollerWithViewController:self alertControllerStyle:UIAlertControllerStyleAlert title:@"温馨提示" message:@"你确定要退出该账号吗?" CallBackBlock:^(NSInteger btnIndex) { 38 | NSLog(@"点击第%li个按钮",btnIndex); 39 | 40 | 41 | } cancelButtonTitle:nil destructiveButtonTitle:@"在考虑" otherButtonTitles:@"确定", nil]; 42 | }]; 43 | [self.view addSubview:button]; 44 | 45 | //普通文本 46 | NSString *text = @"我是普通文本我是普通文本我是普通文本我是普通文本我是普通文本"; 47 | CGFloat maxWidth = 200.0f; 48 | 49 | UILabel *label = [UILabel createLabelWithFrame:CGRectMake((SCREEN_WIDTH - maxWidth)/2,button.bottom + 50, 0,0) text:text titleColor:nil textAlignment:NSTextAlignmentLeft font: FontSize(15.0f)]; 50 | label.height = [label getLabelHeightWithMaxWidth:maxWidth]; 51 | label.backgroundColor = [UIColor redColor]; 52 | [self.view addSubview:label]; 53 | 54 | //富文本 55 | // NSMutableAttributedString *attText = [[NSMutableAttributedString alloc]initWithString:text]; 56 | // NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc]init]; 57 | // style.lineSpacing = 20.0f; 58 | // [attText setAttributes:@{NSParagraphStyleAttributeName:style} range:NSMakeRange(0, text.length)]; 59 | // label.attributedText = attText; 60 | // label.height = [label getAttributeLabelHeightWithText:text maxWidth:maxWidth lineSpacing:20.0f]; 61 | NSLog(@"%f",label.height); 62 | 63 | //显示alertViewController 64 | UIButton *alertButton = [UIButton createBtnFrame:CGRectMake(100, label.bottom + 30,SCREEN_WIDTH - 2*100, 50) title:@"显示alerView" bgImageName:nil action:^(UIButton *button) { 65 | [UIAlertController showAlertCntrollerWithViewController:self alertControllerStyle:UIAlertControllerStyleAlert title:@"温馨提示" message:@"你确定要退出该账号吗?" CallBackBlock:^(NSInteger btnIndex) { 66 | NSLog(@"点击第%li个按钮",btnIndex); 67 | 68 | 69 | } cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"确定",nil]; 70 | }]; 71 | [self.view addSubview:alertButton]; 72 | 73 | 74 | 75 | 76 | } 77 | 78 | 79 | - (void)didReceiveMemoryWarning { 80 | [super didReceiveMemoryWarning]; 81 | // Dispose of any resources that can be recreated. 82 | } 83 | 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /iOS常见控件的封装/iOS_______.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | iOS_______.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /iOS常见控件的封装/iOS_______.xcdatamodeld/iOS_______.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /iOS常见控件的封装/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // iOS常见控件的封装 4 | // 5 | // Created by 张建 on 16/10/17. 6 | // Copyright © 2016年 张建. 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 | -------------------------------------------------------------------------------- /iOS常见控件的封装Tests/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 | -------------------------------------------------------------------------------- /iOS常见控件的封装Tests/iOS_______Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // iOS_______Tests.m 3 | // iOS常见控件的封装Tests 4 | // 5 | // Created by 张建 on 16/10/17. 6 | // Copyright © 2016年 张建. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface iOS_______Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation iOS_______Tests 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 | -------------------------------------------------------------------------------- /iOS常见控件的封装UITests/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 | -------------------------------------------------------------------------------- /iOS常见控件的封装UITests/iOS_______UITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // iOS_______UITests.m 3 | // iOS常见控件的封装UITests 4 | // 5 | // Created by 张建 on 16/10/17. 6 | // Copyright © 2016年 张建. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface iOS_______UITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation iOS_______UITests 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 | --------------------------------------------------------------------------------