├── LXAlertViewDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── liuxin.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── liuxin.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── LXAlertViewDemo.xcscheme │ └── xcschememanagement.plist ├── LXAlertViewDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── LXAlertView │ ├── LXAlertView.h │ ├── LXAlertView.m │ ├── UILabel+LXAdd.h │ └── UILabel+LXAdd.m ├── ViewController.h ├── ViewController.m └── main.m ├── LXAlertViewDemoTests ├── Info.plist └── LXAlertViewDemoTests.m ├── LXAlertViewDemoUITests ├── Info.plist └── LXAlertViewDemoUITests.m └── README.md /LXAlertViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4B20E4F31CC0B46400EABCBA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B20E4F21CC0B46400EABCBA /* main.m */; }; 11 | 4B20E4F61CC0B46400EABCBA /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B20E4F51CC0B46400EABCBA /* AppDelegate.m */; }; 12 | 4B20E4F91CC0B46400EABCBA /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B20E4F81CC0B46400EABCBA /* ViewController.m */; }; 13 | 4B20E4FC1CC0B46400EABCBA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B20E4FA1CC0B46400EABCBA /* Main.storyboard */; }; 14 | 4B20E4FE1CC0B46400EABCBA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4B20E4FD1CC0B46400EABCBA /* Assets.xcassets */; }; 15 | 4B20E5011CC0B46400EABCBA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B20E4FF1CC0B46400EABCBA /* LaunchScreen.storyboard */; }; 16 | 4B20E50C1CC0B46400EABCBA /* LXAlertViewDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B20E50B1CC0B46400EABCBA /* LXAlertViewDemoTests.m */; }; 17 | 4B20E5171CC0B46400EABCBA /* LXAlertViewDemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B20E5161CC0B46400EABCBA /* LXAlertViewDemoUITests.m */; }; 18 | 4B20E5271CC0B90D00EABCBA /* LXAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B20E5261CC0B90D00EABCBA /* LXAlertView.m */; }; 19 | 4B20E52C1CC0F73500EABCBA /* UILabel+LXAdd.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B20E52B1CC0F73500EABCBA /* UILabel+LXAdd.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 4B20E5081CC0B46400EABCBA /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 4B20E4E61CC0B46400EABCBA /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 4B20E4ED1CC0B46400EABCBA; 28 | remoteInfo = LXAlertViewDemo; 29 | }; 30 | 4B20E5131CC0B46400EABCBA /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 4B20E4E61CC0B46400EABCBA /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 4B20E4ED1CC0B46400EABCBA; 35 | remoteInfo = LXAlertViewDemo; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 4B20E4EE1CC0B46400EABCBA /* LXAlertViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LXAlertViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 4B20E4F21CC0B46400EABCBA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 42 | 4B20E4F41CC0B46400EABCBA /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 43 | 4B20E4F51CC0B46400EABCBA /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 44 | 4B20E4F71CC0B46400EABCBA /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 45 | 4B20E4F81CC0B46400EABCBA /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 46 | 4B20E4FB1CC0B46400EABCBA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 47 | 4B20E4FD1CC0B46400EABCBA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 48 | 4B20E5001CC0B46400EABCBA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 49 | 4B20E5021CC0B46400EABCBA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 4B20E5071CC0B46400EABCBA /* LXAlertViewDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LXAlertViewDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 4B20E50B1CC0B46400EABCBA /* LXAlertViewDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LXAlertViewDemoTests.m; sourceTree = ""; }; 52 | 4B20E50D1CC0B46400EABCBA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 4B20E5121CC0B46400EABCBA /* LXAlertViewDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LXAlertViewDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 4B20E5161CC0B46400EABCBA /* LXAlertViewDemoUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LXAlertViewDemoUITests.m; sourceTree = ""; }; 55 | 4B20E5181CC0B46400EABCBA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | 4B20E5251CC0B90D00EABCBA /* LXAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LXAlertView.h; sourceTree = ""; }; 57 | 4B20E5261CC0B90D00EABCBA /* LXAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LXAlertView.m; sourceTree = ""; }; 58 | 4B20E52A1CC0F73500EABCBA /* UILabel+LXAdd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+LXAdd.h"; sourceTree = ""; }; 59 | 4B20E52B1CC0F73500EABCBA /* UILabel+LXAdd.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+LXAdd.m"; sourceTree = ""; }; 60 | /* End PBXFileReference section */ 61 | 62 | /* Begin PBXFrameworksBuildPhase section */ 63 | 4B20E4EB1CC0B46400EABCBA /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | 4B20E5041CC0B46400EABCBA /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | 4B20E50F1CC0B46400EABCBA /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | /* End PBXFrameworksBuildPhase section */ 85 | 86 | /* Begin PBXGroup section */ 87 | 4B20E4E51CC0B46400EABCBA = { 88 | isa = PBXGroup; 89 | children = ( 90 | 4B20E4F01CC0B46400EABCBA /* LXAlertViewDemo */, 91 | 4B20E50A1CC0B46400EABCBA /* LXAlertViewDemoTests */, 92 | 4B20E5151CC0B46400EABCBA /* LXAlertViewDemoUITests */, 93 | 4B20E4EF1CC0B46400EABCBA /* Products */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | 4B20E4EF1CC0B46400EABCBA /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 4B20E4EE1CC0B46400EABCBA /* LXAlertViewDemo.app */, 101 | 4B20E5071CC0B46400EABCBA /* LXAlertViewDemoTests.xctest */, 102 | 4B20E5121CC0B46400EABCBA /* LXAlertViewDemoUITests.xctest */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | 4B20E4F01CC0B46400EABCBA /* LXAlertViewDemo */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 4B20E5241CC0B8A800EABCBA /* LXAlertView */, 111 | 4B20E4F41CC0B46400EABCBA /* AppDelegate.h */, 112 | 4B20E4F51CC0B46400EABCBA /* AppDelegate.m */, 113 | 4B20E4F71CC0B46400EABCBA /* ViewController.h */, 114 | 4B20E4F81CC0B46400EABCBA /* ViewController.m */, 115 | 4B20E4FA1CC0B46400EABCBA /* Main.storyboard */, 116 | 4B20E4FD1CC0B46400EABCBA /* Assets.xcassets */, 117 | 4B20E4FF1CC0B46400EABCBA /* LaunchScreen.storyboard */, 118 | 4B20E5021CC0B46400EABCBA /* Info.plist */, 119 | 4B20E4F11CC0B46400EABCBA /* Supporting Files */, 120 | ); 121 | path = LXAlertViewDemo; 122 | sourceTree = ""; 123 | }; 124 | 4B20E4F11CC0B46400EABCBA /* Supporting Files */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 4B20E4F21CC0B46400EABCBA /* main.m */, 128 | ); 129 | name = "Supporting Files"; 130 | sourceTree = ""; 131 | }; 132 | 4B20E50A1CC0B46400EABCBA /* LXAlertViewDemoTests */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 4B20E50B1CC0B46400EABCBA /* LXAlertViewDemoTests.m */, 136 | 4B20E50D1CC0B46400EABCBA /* Info.plist */, 137 | ); 138 | path = LXAlertViewDemoTests; 139 | sourceTree = ""; 140 | }; 141 | 4B20E5151CC0B46400EABCBA /* LXAlertViewDemoUITests */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 4B20E5161CC0B46400EABCBA /* LXAlertViewDemoUITests.m */, 145 | 4B20E5181CC0B46400EABCBA /* Info.plist */, 146 | ); 147 | path = LXAlertViewDemoUITests; 148 | sourceTree = ""; 149 | }; 150 | 4B20E5241CC0B8A800EABCBA /* LXAlertView */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 4B20E52A1CC0F73500EABCBA /* UILabel+LXAdd.h */, 154 | 4B20E52B1CC0F73500EABCBA /* UILabel+LXAdd.m */, 155 | 4B20E5251CC0B90D00EABCBA /* LXAlertView.h */, 156 | 4B20E5261CC0B90D00EABCBA /* LXAlertView.m */, 157 | ); 158 | path = LXAlertView; 159 | sourceTree = ""; 160 | }; 161 | /* End PBXGroup section */ 162 | 163 | /* Begin PBXNativeTarget section */ 164 | 4B20E4ED1CC0B46400EABCBA /* LXAlertViewDemo */ = { 165 | isa = PBXNativeTarget; 166 | buildConfigurationList = 4B20E51B1CC0B46400EABCBA /* Build configuration list for PBXNativeTarget "LXAlertViewDemo" */; 167 | buildPhases = ( 168 | 4B20E4EA1CC0B46400EABCBA /* Sources */, 169 | 4B20E4EB1CC0B46400EABCBA /* Frameworks */, 170 | 4B20E4EC1CC0B46400EABCBA /* Resources */, 171 | ); 172 | buildRules = ( 173 | ); 174 | dependencies = ( 175 | ); 176 | name = LXAlertViewDemo; 177 | productName = LXAlertViewDemo; 178 | productReference = 4B20E4EE1CC0B46400EABCBA /* LXAlertViewDemo.app */; 179 | productType = "com.apple.product-type.application"; 180 | }; 181 | 4B20E5061CC0B46400EABCBA /* LXAlertViewDemoTests */ = { 182 | isa = PBXNativeTarget; 183 | buildConfigurationList = 4B20E51E1CC0B46400EABCBA /* Build configuration list for PBXNativeTarget "LXAlertViewDemoTests" */; 184 | buildPhases = ( 185 | 4B20E5031CC0B46400EABCBA /* Sources */, 186 | 4B20E5041CC0B46400EABCBA /* Frameworks */, 187 | 4B20E5051CC0B46400EABCBA /* Resources */, 188 | ); 189 | buildRules = ( 190 | ); 191 | dependencies = ( 192 | 4B20E5091CC0B46400EABCBA /* PBXTargetDependency */, 193 | ); 194 | name = LXAlertViewDemoTests; 195 | productName = LXAlertViewDemoTests; 196 | productReference = 4B20E5071CC0B46400EABCBA /* LXAlertViewDemoTests.xctest */; 197 | productType = "com.apple.product-type.bundle.unit-test"; 198 | }; 199 | 4B20E5111CC0B46400EABCBA /* LXAlertViewDemoUITests */ = { 200 | isa = PBXNativeTarget; 201 | buildConfigurationList = 4B20E5211CC0B46400EABCBA /* Build configuration list for PBXNativeTarget "LXAlertViewDemoUITests" */; 202 | buildPhases = ( 203 | 4B20E50E1CC0B46400EABCBA /* Sources */, 204 | 4B20E50F1CC0B46400EABCBA /* Frameworks */, 205 | 4B20E5101CC0B46400EABCBA /* Resources */, 206 | ); 207 | buildRules = ( 208 | ); 209 | dependencies = ( 210 | 4B20E5141CC0B46400EABCBA /* PBXTargetDependency */, 211 | ); 212 | name = LXAlertViewDemoUITests; 213 | productName = LXAlertViewDemoUITests; 214 | productReference = 4B20E5121CC0B46400EABCBA /* LXAlertViewDemoUITests.xctest */; 215 | productType = "com.apple.product-type.bundle.ui-testing"; 216 | }; 217 | /* End PBXNativeTarget section */ 218 | 219 | /* Begin PBXProject section */ 220 | 4B20E4E61CC0B46400EABCBA /* Project object */ = { 221 | isa = PBXProject; 222 | attributes = { 223 | LastUpgradeCheck = 0730; 224 | ORGANIZATIONNAME = liuxin; 225 | TargetAttributes = { 226 | 4B20E4ED1CC0B46400EABCBA = { 227 | CreatedOnToolsVersion = 7.3; 228 | }; 229 | 4B20E5061CC0B46400EABCBA = { 230 | CreatedOnToolsVersion = 7.3; 231 | TestTargetID = 4B20E4ED1CC0B46400EABCBA; 232 | }; 233 | 4B20E5111CC0B46400EABCBA = { 234 | CreatedOnToolsVersion = 7.3; 235 | TestTargetID = 4B20E4ED1CC0B46400EABCBA; 236 | }; 237 | }; 238 | }; 239 | buildConfigurationList = 4B20E4E91CC0B46400EABCBA /* Build configuration list for PBXProject "LXAlertViewDemo" */; 240 | compatibilityVersion = "Xcode 3.2"; 241 | developmentRegion = English; 242 | hasScannedForEncodings = 0; 243 | knownRegions = ( 244 | en, 245 | Base, 246 | ); 247 | mainGroup = 4B20E4E51CC0B46400EABCBA; 248 | productRefGroup = 4B20E4EF1CC0B46400EABCBA /* Products */; 249 | projectDirPath = ""; 250 | projectRoot = ""; 251 | targets = ( 252 | 4B20E4ED1CC0B46400EABCBA /* LXAlertViewDemo */, 253 | 4B20E5061CC0B46400EABCBA /* LXAlertViewDemoTests */, 254 | 4B20E5111CC0B46400EABCBA /* LXAlertViewDemoUITests */, 255 | ); 256 | }; 257 | /* End PBXProject section */ 258 | 259 | /* Begin PBXResourcesBuildPhase section */ 260 | 4B20E4EC1CC0B46400EABCBA /* Resources */ = { 261 | isa = PBXResourcesBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | 4B20E5011CC0B46400EABCBA /* LaunchScreen.storyboard in Resources */, 265 | 4B20E4FE1CC0B46400EABCBA /* Assets.xcassets in Resources */, 266 | 4B20E4FC1CC0B46400EABCBA /* Main.storyboard in Resources */, 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | }; 270 | 4B20E5051CC0B46400EABCBA /* Resources */ = { 271 | isa = PBXResourcesBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | ); 275 | runOnlyForDeploymentPostprocessing = 0; 276 | }; 277 | 4B20E5101CC0B46400EABCBA /* Resources */ = { 278 | isa = PBXResourcesBuildPhase; 279 | buildActionMask = 2147483647; 280 | files = ( 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | }; 284 | /* End PBXResourcesBuildPhase section */ 285 | 286 | /* Begin PBXSourcesBuildPhase section */ 287 | 4B20E4EA1CC0B46400EABCBA /* Sources */ = { 288 | isa = PBXSourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | 4B20E4F91CC0B46400EABCBA /* ViewController.m in Sources */, 292 | 4B20E4F61CC0B46400EABCBA /* AppDelegate.m in Sources */, 293 | 4B20E4F31CC0B46400EABCBA /* main.m in Sources */, 294 | 4B20E52C1CC0F73500EABCBA /* UILabel+LXAdd.m in Sources */, 295 | 4B20E5271CC0B90D00EABCBA /* LXAlertView.m in Sources */, 296 | ); 297 | runOnlyForDeploymentPostprocessing = 0; 298 | }; 299 | 4B20E5031CC0B46400EABCBA /* Sources */ = { 300 | isa = PBXSourcesBuildPhase; 301 | buildActionMask = 2147483647; 302 | files = ( 303 | 4B20E50C1CC0B46400EABCBA /* LXAlertViewDemoTests.m in Sources */, 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | }; 307 | 4B20E50E1CC0B46400EABCBA /* Sources */ = { 308 | isa = PBXSourcesBuildPhase; 309 | buildActionMask = 2147483647; 310 | files = ( 311 | 4B20E5171CC0B46400EABCBA /* LXAlertViewDemoUITests.m in Sources */, 312 | ); 313 | runOnlyForDeploymentPostprocessing = 0; 314 | }; 315 | /* End PBXSourcesBuildPhase section */ 316 | 317 | /* Begin PBXTargetDependency section */ 318 | 4B20E5091CC0B46400EABCBA /* PBXTargetDependency */ = { 319 | isa = PBXTargetDependency; 320 | target = 4B20E4ED1CC0B46400EABCBA /* LXAlertViewDemo */; 321 | targetProxy = 4B20E5081CC0B46400EABCBA /* PBXContainerItemProxy */; 322 | }; 323 | 4B20E5141CC0B46400EABCBA /* PBXTargetDependency */ = { 324 | isa = PBXTargetDependency; 325 | target = 4B20E4ED1CC0B46400EABCBA /* LXAlertViewDemo */; 326 | targetProxy = 4B20E5131CC0B46400EABCBA /* PBXContainerItemProxy */; 327 | }; 328 | /* End PBXTargetDependency section */ 329 | 330 | /* Begin PBXVariantGroup section */ 331 | 4B20E4FA1CC0B46400EABCBA /* Main.storyboard */ = { 332 | isa = PBXVariantGroup; 333 | children = ( 334 | 4B20E4FB1CC0B46400EABCBA /* Base */, 335 | ); 336 | name = Main.storyboard; 337 | sourceTree = ""; 338 | }; 339 | 4B20E4FF1CC0B46400EABCBA /* LaunchScreen.storyboard */ = { 340 | isa = PBXVariantGroup; 341 | children = ( 342 | 4B20E5001CC0B46400EABCBA /* Base */, 343 | ); 344 | name = LaunchScreen.storyboard; 345 | sourceTree = ""; 346 | }; 347 | /* End PBXVariantGroup section */ 348 | 349 | /* Begin XCBuildConfiguration section */ 350 | 4B20E5191CC0B46400EABCBA /* Debug */ = { 351 | isa = XCBuildConfiguration; 352 | buildSettings = { 353 | ALWAYS_SEARCH_USER_PATHS = NO; 354 | CLANG_ANALYZER_NONNULL = YES; 355 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 356 | CLANG_CXX_LIBRARY = "libc++"; 357 | CLANG_ENABLE_MODULES = YES; 358 | CLANG_ENABLE_OBJC_ARC = YES; 359 | CLANG_WARN_BOOL_CONVERSION = YES; 360 | CLANG_WARN_CONSTANT_CONVERSION = YES; 361 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 362 | CLANG_WARN_EMPTY_BODY = YES; 363 | CLANG_WARN_ENUM_CONVERSION = YES; 364 | CLANG_WARN_INT_CONVERSION = YES; 365 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 366 | CLANG_WARN_UNREACHABLE_CODE = YES; 367 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 368 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 369 | COPY_PHASE_STRIP = NO; 370 | DEBUG_INFORMATION_FORMAT = dwarf; 371 | ENABLE_STRICT_OBJC_MSGSEND = YES; 372 | ENABLE_TESTABILITY = YES; 373 | GCC_C_LANGUAGE_STANDARD = gnu99; 374 | GCC_DYNAMIC_NO_PIC = NO; 375 | GCC_NO_COMMON_BLOCKS = YES; 376 | GCC_OPTIMIZATION_LEVEL = 0; 377 | GCC_PREPROCESSOR_DEFINITIONS = ( 378 | "DEBUG=1", 379 | "$(inherited)", 380 | ); 381 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 382 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 383 | GCC_WARN_UNDECLARED_SELECTOR = YES; 384 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 385 | GCC_WARN_UNUSED_FUNCTION = YES; 386 | GCC_WARN_UNUSED_VARIABLE = YES; 387 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 388 | MTL_ENABLE_DEBUG_INFO = YES; 389 | ONLY_ACTIVE_ARCH = YES; 390 | SDKROOT = iphoneos; 391 | }; 392 | name = Debug; 393 | }; 394 | 4B20E51A1CC0B46400EABCBA /* Release */ = { 395 | isa = XCBuildConfiguration; 396 | buildSettings = { 397 | ALWAYS_SEARCH_USER_PATHS = NO; 398 | CLANG_ANALYZER_NONNULL = YES; 399 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 400 | CLANG_CXX_LIBRARY = "libc++"; 401 | CLANG_ENABLE_MODULES = YES; 402 | CLANG_ENABLE_OBJC_ARC = YES; 403 | CLANG_WARN_BOOL_CONVERSION = YES; 404 | CLANG_WARN_CONSTANT_CONVERSION = YES; 405 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 406 | CLANG_WARN_EMPTY_BODY = YES; 407 | CLANG_WARN_ENUM_CONVERSION = YES; 408 | CLANG_WARN_INT_CONVERSION = YES; 409 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 410 | CLANG_WARN_UNREACHABLE_CODE = YES; 411 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 412 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 413 | COPY_PHASE_STRIP = NO; 414 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 415 | ENABLE_NS_ASSERTIONS = NO; 416 | ENABLE_STRICT_OBJC_MSGSEND = YES; 417 | GCC_C_LANGUAGE_STANDARD = gnu99; 418 | GCC_NO_COMMON_BLOCKS = YES; 419 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 420 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 421 | GCC_WARN_UNDECLARED_SELECTOR = YES; 422 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 423 | GCC_WARN_UNUSED_FUNCTION = YES; 424 | GCC_WARN_UNUSED_VARIABLE = YES; 425 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 426 | MTL_ENABLE_DEBUG_INFO = NO; 427 | SDKROOT = iphoneos; 428 | VALIDATE_PRODUCT = YES; 429 | }; 430 | name = Release; 431 | }; 432 | 4B20E51C1CC0B46400EABCBA /* Debug */ = { 433 | isa = XCBuildConfiguration; 434 | buildSettings = { 435 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 436 | INFOPLIST_FILE = LXAlertViewDemo/Info.plist; 437 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 438 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 439 | PRODUCT_BUNDLE_IDENTIFIER = com.lx.spread.LXAlertViewDemo; 440 | PRODUCT_NAME = "$(TARGET_NAME)"; 441 | }; 442 | name = Debug; 443 | }; 444 | 4B20E51D1CC0B46400EABCBA /* Release */ = { 445 | isa = XCBuildConfiguration; 446 | buildSettings = { 447 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 448 | INFOPLIST_FILE = LXAlertViewDemo/Info.plist; 449 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 450 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 451 | PRODUCT_BUNDLE_IDENTIFIER = com.lx.spread.LXAlertViewDemo; 452 | PRODUCT_NAME = "$(TARGET_NAME)"; 453 | }; 454 | name = Release; 455 | }; 456 | 4B20E51F1CC0B46400EABCBA /* Debug */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | BUNDLE_LOADER = "$(TEST_HOST)"; 460 | INFOPLIST_FILE = LXAlertViewDemoTests/Info.plist; 461 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 462 | PRODUCT_BUNDLE_IDENTIFIER = com.lx.spread.LXAlertViewDemoTests; 463 | PRODUCT_NAME = "$(TARGET_NAME)"; 464 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LXAlertViewDemo.app/LXAlertViewDemo"; 465 | }; 466 | name = Debug; 467 | }; 468 | 4B20E5201CC0B46400EABCBA /* Release */ = { 469 | isa = XCBuildConfiguration; 470 | buildSettings = { 471 | BUNDLE_LOADER = "$(TEST_HOST)"; 472 | INFOPLIST_FILE = LXAlertViewDemoTests/Info.plist; 473 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 474 | PRODUCT_BUNDLE_IDENTIFIER = com.lx.spread.LXAlertViewDemoTests; 475 | PRODUCT_NAME = "$(TARGET_NAME)"; 476 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LXAlertViewDemo.app/LXAlertViewDemo"; 477 | }; 478 | name = Release; 479 | }; 480 | 4B20E5221CC0B46400EABCBA /* Debug */ = { 481 | isa = XCBuildConfiguration; 482 | buildSettings = { 483 | INFOPLIST_FILE = LXAlertViewDemoUITests/Info.plist; 484 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 485 | PRODUCT_BUNDLE_IDENTIFIER = com.lx.spread.LXAlertViewDemoUITests; 486 | PRODUCT_NAME = "$(TARGET_NAME)"; 487 | TEST_TARGET_NAME = LXAlertViewDemo; 488 | }; 489 | name = Debug; 490 | }; 491 | 4B20E5231CC0B46400EABCBA /* Release */ = { 492 | isa = XCBuildConfiguration; 493 | buildSettings = { 494 | INFOPLIST_FILE = LXAlertViewDemoUITests/Info.plist; 495 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 496 | PRODUCT_BUNDLE_IDENTIFIER = com.lx.spread.LXAlertViewDemoUITests; 497 | PRODUCT_NAME = "$(TARGET_NAME)"; 498 | TEST_TARGET_NAME = LXAlertViewDemo; 499 | }; 500 | name = Release; 501 | }; 502 | /* End XCBuildConfiguration section */ 503 | 504 | /* Begin XCConfigurationList section */ 505 | 4B20E4E91CC0B46400EABCBA /* Build configuration list for PBXProject "LXAlertViewDemo" */ = { 506 | isa = XCConfigurationList; 507 | buildConfigurations = ( 508 | 4B20E5191CC0B46400EABCBA /* Debug */, 509 | 4B20E51A1CC0B46400EABCBA /* Release */, 510 | ); 511 | defaultConfigurationIsVisible = 0; 512 | defaultConfigurationName = Release; 513 | }; 514 | 4B20E51B1CC0B46400EABCBA /* Build configuration list for PBXNativeTarget "LXAlertViewDemo" */ = { 515 | isa = XCConfigurationList; 516 | buildConfigurations = ( 517 | 4B20E51C1CC0B46400EABCBA /* Debug */, 518 | 4B20E51D1CC0B46400EABCBA /* Release */, 519 | ); 520 | defaultConfigurationIsVisible = 0; 521 | defaultConfigurationName = Release; 522 | }; 523 | 4B20E51E1CC0B46400EABCBA /* Build configuration list for PBXNativeTarget "LXAlertViewDemoTests" */ = { 524 | isa = XCConfigurationList; 525 | buildConfigurations = ( 526 | 4B20E51F1CC0B46400EABCBA /* Debug */, 527 | 4B20E5201CC0B46400EABCBA /* Release */, 528 | ); 529 | defaultConfigurationIsVisible = 0; 530 | defaultConfigurationName = Release; 531 | }; 532 | 4B20E5211CC0B46400EABCBA /* Build configuration list for PBXNativeTarget "LXAlertViewDemoUITests" */ = { 533 | isa = XCConfigurationList; 534 | buildConfigurations = ( 535 | 4B20E5221CC0B46400EABCBA /* Debug */, 536 | 4B20E5231CC0B46400EABCBA /* Release */, 537 | ); 538 | defaultConfigurationIsVisible = 0; 539 | defaultConfigurationName = Release; 540 | }; 541 | /* End XCConfigurationList section */ 542 | }; 543 | rootObject = 4B20E4E61CC0B46400EABCBA /* Project object */; 544 | } 545 | -------------------------------------------------------------------------------- /LXAlertViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LXAlertViewDemo.xcodeproj/project.xcworkspace/xcuserdata/liuxin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xinge1/LXAlertViewDemo/be3ba73cb501c195ced7f4c7971870c510e3ebc2/LXAlertViewDemo.xcodeproj/project.xcworkspace/xcuserdata/liuxin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LXAlertViewDemo.xcodeproj/xcuserdata/liuxin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /LXAlertViewDemo.xcodeproj/xcuserdata/liuxin.xcuserdatad/xcschemes/LXAlertViewDemo.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 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /LXAlertViewDemo.xcodeproj/xcuserdata/liuxin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LXAlertViewDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4B20E4ED1CC0B46400EABCBA 16 | 17 | primary 18 | 19 | 20 | 4B20E5061CC0B46400EABCBA 21 | 22 | primary 23 | 24 | 25 | 4B20E5111CC0B46400EABCBA 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /LXAlertViewDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LXAlertViewDemo 4 | // 5 | // Created by 刘鑫 on 16/4/15. 6 | // Copyright © 2016年 liuxin. 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 | -------------------------------------------------------------------------------- /LXAlertViewDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LXAlertViewDemo 4 | // 5 | // Created by 刘鑫 on 16/4/15. 6 | // Copyright © 2016年 liuxin. 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 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /LXAlertViewDemo/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 | } -------------------------------------------------------------------------------- /LXAlertViewDemo/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 | -------------------------------------------------------------------------------- /LXAlertViewDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 43 | 50 | 57 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /LXAlertViewDemo/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /LXAlertViewDemo/LXAlertView/LXAlertView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LXAlertView.h 3 | // LXAlertViewDemo 4 | // 5 | // Created by 刘鑫 on 16/4/15. 6 | // Copyright © 2016年 liuxin. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | 12 | typedef NS_ENUM(NSInteger , LXAShowAnimationStyle) { 13 | LXASAnimationDefault = 0, 14 | LXASAnimationLeftShake , 15 | LXASAnimationTopShake , 16 | LXASAnimationNO , 17 | }; 18 | 19 | typedef void(^LXAlertClickIndexBlock)(NSInteger clickIndex); 20 | 21 | 22 | @interface LXAlertView : UIView 23 | 24 | @property (nonatomic,copy)LXAlertClickIndexBlock clickBlock; 25 | 26 | @property (nonatomic,assign)LXAShowAnimationStyle animationStyle; 27 | 28 | /** 29 | * 初始化alert方法(根据内容自适应大小,目前只支持1个按钮或2个按钮) 30 | * 31 | * @param title 标题 32 | * @param message 内容(根据内容自适应大小) 33 | * @param cancelTitle 取消按钮 34 | * @param otherBtnTitle 其他按钮 35 | * @param block 点击事件block 36 | * 37 | * @return 返回alert对象 38 | */ 39 | -(instancetype)initWithTitle:(NSString *)title message:(NSString *)message cancelBtnTitle:(NSString *)cancelTitle otherBtnTitle:(NSString *)otherBtnTitle clickIndexBlock:(LXAlertClickIndexBlock)block; 40 | 41 | /** 42 | * showLXAlertView 43 | */ 44 | -(void)showLXAlertView; 45 | 46 | /** 47 | * 不隐藏,默认为NO。设置为YES时点击按钮alertView不会消失(适合在强制升级时使用) 48 | */ 49 | @property (nonatomic,assign)BOOL dontDissmiss; 50 | @end 51 | 52 | 53 | 54 | @interface UIImage (colorful) 55 | //a image using a color 56 | + (UIImage *)imageWithColor:(UIColor *)color; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /LXAlertViewDemo/LXAlertView/LXAlertView.m: -------------------------------------------------------------------------------- 1 | // 2 | // LXAlertView.m 3 | // LXAlertViewDemo 4 | // 5 | // Created by 刘鑫 on 16/4/15. 6 | // Copyright © 2016年 liuxin. All rights reserved. 7 | // 8 | #define MainScreenRect [UIScreen mainScreen].bounds 9 | #define AlertView_W 270.0f 10 | #define MessageMin_H 60.0f //messagelab的最小高度 11 | #define MessageMAX_H 120.0f //messagelab的最大高度,当超过时,文本会以...结尾 12 | #define LXATitle_H 20.0f 13 | #define LXABtn_H 30.0f 14 | 15 | #define SFQBlueColor [UIColor colorWithRed:9/255.0 green:170/255.0 blue:238/255.0 alpha:1] 16 | #define SFQRedColor [UIColor colorWithRed:255/255.0 green:92/255.0 blue:79/255.0 alpha:1] 17 | #define SFQLightGrayColor [UIColor colorWithRed:200/255.0 green:200/255.0 blue:200/255.0 alpha:1] 18 | 19 | #define LXADTitleFont [UIFont boldSystemFontOfSize:17]; 20 | #define LXADMessageFont [UIFont systemFontOfSize:14]; 21 | #define LXADBtnTitleFont [UIFont systemFontOfSize:15]; 22 | 23 | 24 | 25 | #import "LXAlertView.h" 26 | #import "UILabel+LXAdd.h" 27 | 28 | @interface LXAlertView() 29 | @property (nonatomic,strong)UIWindow *alertWindow; 30 | @property (nonatomic,strong)UIView *alertView; 31 | 32 | @property (nonatomic,strong)UILabel *titleLab; 33 | @property (nonatomic,strong)UILabel *messageLab; 34 | @property (nonatomic,strong)UIButton *cancelBtn; 35 | @property (nonatomic,strong)UIButton *otherBtn; 36 | @end 37 | 38 | @implementation LXAlertView 39 | 40 | /* 41 | // Only override drawRect: if you perform custom drawing. 42 | // An empty implementation adversely affects performance during animation. 43 | - (void)drawRect:(CGRect)rect { 44 | // Drawing code 45 | } 46 | */ 47 | 48 | -(instancetype)initWithTitle:(NSString *)title message:(NSString *)message cancelBtnTitle:(NSString *)cancelTitle otherBtnTitle:(NSString *)otherBtnTitle clickIndexBlock:(LXAlertClickIndexBlock)block{ 49 | if(self=[super init]){ 50 | self.frame=MainScreenRect; 51 | self.backgroundColor=[UIColor colorWithWhite:.3 alpha:.7]; 52 | 53 | _alertView=[[UIView alloc] init]; 54 | _alertView.backgroundColor=[UIColor whiteColor]; 55 | _alertView.layer.cornerRadius=6.0; 56 | _alertView.layer.masksToBounds=YES; 57 | _alertView.userInteractionEnabled=YES; 58 | 59 | 60 | if (title) { 61 | _titleLab=[[UILabel alloc] initWithFrame:CGRectMake(0, 10, AlertView_W, LXATitle_H)]; 62 | _titleLab.text=title; 63 | _titleLab.textAlignment=NSTextAlignmentCenter; 64 | _titleLab.textColor=[UIColor blackColor]; 65 | _titleLab.font=LXADTitleFont; 66 | 67 | } 68 | 69 | CGFloat messageLabSpace = 25; 70 | _messageLab=[[UILabel alloc] init]; 71 | _messageLab.backgroundColor=[UIColor whiteColor]; 72 | _messageLab.text=message; 73 | _messageLab.textColor=[UIColor lightGrayColor]; 74 | _messageLab.font=LXADMessageFont; 75 | _messageLab.numberOfLines=0; 76 | _messageLab.textAlignment=NSTextAlignmentCenter; 77 | _messageLab.lineBreakMode=NSLineBreakByTruncatingTail; 78 | _messageLab.characterSpace=2; 79 | _messageLab.lineSpace=3; 80 | CGSize labSize = [_messageLab getLableRectWithMaxWidth:AlertView_W-messageLabSpace*2]; 81 | CGFloat messageLabAotuH = labSize.height < MessageMin_H?MessageMin_H:labSize.height; 82 | CGFloat endMessageLabH = messageLabAotuH > MessageMAX_H?MessageMAX_H:messageLabAotuH; 83 | _messageLab.frame=CGRectMake(messageLabSpace, _titleLab.frame.size.height+_titleLab.frame.origin.y+10, AlertView_W-messageLabSpace*2, endMessageLabH); 84 | 85 | 86 | //计算_alertView的高度 87 | _alertView.frame=CGRectMake(0, 0, AlertView_W, _messageLab.frame.size.height+LXATitle_H+LXABtn_H+40); 88 | _alertView.center=self.center; 89 | [self addSubview:_alertView]; 90 | [_alertView addSubview:_titleLab]; 91 | [_alertView addSubview:_messageLab]; 92 | 93 | if (cancelTitle) { 94 | _cancelBtn=[UIButton buttonWithType:UIButtonTypeCustom]; 95 | [_cancelBtn setTitle:cancelTitle forState:UIControlStateNormal]; 96 | [_cancelBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 97 | [_cancelBtn setBackgroundImage:[UIImage imageWithColor:SFQLightGrayColor] forState:UIControlStateNormal]; 98 | _cancelBtn.titleLabel.font=LXADBtnTitleFont; 99 | _cancelBtn.layer.cornerRadius=3; 100 | _cancelBtn.layer.masksToBounds=YES; 101 | [_cancelBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside]; 102 | [_alertView addSubview:_cancelBtn]; 103 | } 104 | 105 | if (otherBtnTitle) { 106 | _otherBtn=[UIButton buttonWithType:UIButtonTypeCustom]; 107 | [_otherBtn setTitle:otherBtnTitle forState:UIControlStateNormal]; 108 | [_otherBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 109 | _otherBtn.titleLabel.font=LXADBtnTitleFont; 110 | _otherBtn.layer.cornerRadius=3; 111 | _otherBtn.layer.masksToBounds=YES; 112 | [_otherBtn setBackgroundImage:[UIImage imageWithColor:SFQRedColor] forState:UIControlStateNormal]; 113 | [_otherBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside]; 114 | [_alertView addSubview:_otherBtn]; 115 | } 116 | 117 | CGFloat btnLeftSpace = 40;//btn到左边距 118 | CGFloat btn_y = _alertView.frame.size.height-40; 119 | if (cancelTitle && !otherBtnTitle) { 120 | _cancelBtn.tag=0; 121 | _cancelBtn.frame=CGRectMake(btnLeftSpace, btn_y, AlertView_W-btnLeftSpace*2, LXABtn_H); 122 | }else if (!cancelTitle && otherBtnTitle){ 123 | _otherBtn.tag=0; 124 | _otherBtn.frame=CGRectMake(btnLeftSpace, btn_y, AlertView_W-btnLeftSpace*2, LXABtn_H); 125 | }else if (cancelTitle && otherBtnTitle){ 126 | _cancelBtn.tag=0; 127 | _otherBtn.tag=1; 128 | CGFloat btnSpace = 20;//两个btn之间的间距 129 | CGFloat btn_w =(AlertView_W-btnLeftSpace*2-btnSpace)/2; 130 | _cancelBtn.frame=CGRectMake(btnLeftSpace, btn_y, btn_w, LXABtn_H); 131 | _otherBtn.frame=CGRectMake(_alertView.frame.size.width-btn_w-btnLeftSpace, btn_y, btn_w, LXABtn_H); 132 | } 133 | 134 | self.clickBlock=block; 135 | 136 | } 137 | return self; 138 | } 139 | 140 | 141 | -(void)btnClick:(UIButton *)btn{ 142 | 143 | if (self.clickBlock) { 144 | self.clickBlock(btn.tag); 145 | } 146 | 147 | if (!_dontDissmiss) { 148 | [self dismissAlertView]; 149 | } 150 | 151 | } 152 | 153 | -(void)setDontDissmiss:(BOOL)dontDissmiss{ 154 | _dontDissmiss=dontDissmiss; 155 | } 156 | 157 | -(void)showLXAlertView{ 158 | 159 | 160 | 161 | _alertWindow=[[UIWindow alloc] initWithFrame:MainScreenRect]; 162 | _alertWindow.windowLevel=UIWindowLevelAlert; 163 | [_alertWindow becomeKeyWindow]; 164 | [_alertWindow makeKeyAndVisible]; 165 | 166 | [_alertWindow addSubview:self]; 167 | 168 | [self setShowAnimation]; 169 | 170 | } 171 | 172 | -(void)dismissAlertView{ 173 | [self removeFromSuperview]; 174 | [_alertWindow resignKeyWindow]; 175 | } 176 | 177 | -(void)setShowAnimation{ 178 | 179 | switch (_animationStyle) { 180 | 181 | case LXASAnimationDefault: 182 | { 183 | [UIView animateWithDuration:0 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 184 | [_alertView.layer setValue:@(0) forKeyPath:@"transform.scale"]; 185 | } completion:^(BOOL finished) { 186 | [UIView animateWithDuration:0.23 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 187 | [_alertView.layer setValue:@(1.2) forKeyPath:@"transform.scale"]; 188 | } completion:^(BOOL finished) { 189 | [UIView animateWithDuration:0.09 delay:0.02 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 190 | [_alertView.layer setValue:@(.9) forKeyPath:@"transform.scale"]; 191 | } completion:^(BOOL finished) { 192 | [UIView animateWithDuration:0.05 delay:0.02 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 193 | [_alertView.layer setValue:@(1.0) forKeyPath:@"transform.scale"]; 194 | } completion:^(BOOL finished) { 195 | 196 | }]; 197 | }]; 198 | }]; 199 | }]; 200 | } 201 | break; 202 | 203 | case LXASAnimationLeftShake:{ 204 | 205 | CGPoint startPoint = CGPointMake(-AlertView_W, self.center.y); 206 | _alertView.layer.position=startPoint; 207 | 208 | //damping:阻尼,范围0-1,阻尼越接近于0,弹性效果越明显 209 | //velocity:弹性复位的速度 210 | [UIView animateWithDuration:.8 delay:0 usingSpringWithDamping:.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ 211 | _alertView.layer.position=self.center; 212 | 213 | } completion:^(BOOL finished) { 214 | 215 | }]; 216 | } 217 | break; 218 | 219 | case LXASAnimationTopShake:{ 220 | 221 | CGPoint startPoint = CGPointMake(self.center.x, -_alertView.frame.size.height); 222 | _alertView.layer.position=startPoint; 223 | 224 | //damping:阻尼,范围0-1,阻尼越接近于0,弹性效果越明显 225 | //velocity:弹性复位的速度 226 | [UIView animateWithDuration:.8 delay:0 usingSpringWithDamping:.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ 227 | _alertView.layer.position=self.center; 228 | 229 | } completion:^(BOOL finished) { 230 | 231 | }]; 232 | } 233 | break; 234 | 235 | case LXASAnimationNO:{ 236 | 237 | } 238 | 239 | break; 240 | 241 | default: 242 | break; 243 | } 244 | 245 | } 246 | 247 | 248 | -(void)setAnimationStyle:(LXAShowAnimationStyle)animationStyle{ 249 | _animationStyle=animationStyle; 250 | } 251 | 252 | @end 253 | 254 | 255 | 256 | 257 | 258 | @implementation UIImage (Colorful) 259 | 260 | + (UIImage *)imageWithColor:(UIColor *)color 261 | { 262 | CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); 263 | UIGraphicsBeginImageContext(rect.size); 264 | CGContextRef context = UIGraphicsGetCurrentContext(); 265 | 266 | CGContextSetFillColorWithColor(context, [color CGColor]); 267 | CGContextFillRect(context, rect); 268 | 269 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 270 | UIGraphicsEndImageContext(); 271 | 272 | return image; 273 | } 274 | 275 | @end 276 | -------------------------------------------------------------------------------- /LXAlertViewDemo/LXAlertView/UILabel+LXAdd.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+LXAdd.h 3 | // LXLabelDemo 4 | // 5 | // Created by 刘鑫 on 16/4/13. 6 | // Copyright © 2016年 liuxin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UILabel (LXAdd) 12 | /** 13 | * 字间距 14 | */ 15 | @property (nonatomic,assign)CGFloat characterSpace; 16 | 17 | /** 18 | * 行间距 19 | */ 20 | @property (nonatomic,assign)CGFloat lineSpace; 21 | 22 | /** 23 | * 关键字 24 | */ 25 | @property (nonatomic,copy)NSString *keywords; 26 | @property (nonatomic,strong)UIFont *keywordsFont; 27 | @property (nonatomic,strong)UIColor *keywordsColor; 28 | 29 | /** 30 | * 下划线 31 | */ 32 | @property (nonatomic,copy)NSString *underlineStr; 33 | @property (nonatomic,strong)UIColor *underlineColor; 34 | 35 | /** 36 | * 计算label宽高,必须调用 37 | * 38 | * @param maxWidth 最大宽度 39 | * 40 | * @return label的rect 41 | */ 42 | - (CGSize)getLableRectWithMaxWidth:(CGFloat)maxWidth; 43 | @end 44 | -------------------------------------------------------------------------------- /LXAlertViewDemo/LXAlertView/UILabel+LXAdd.m: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+LXAdd.m 3 | // LXLabelDemo 4 | // 5 | // Created by 刘鑫 on 16/4/13. 6 | // Copyright © 2016年 liuxin. All rights reserved. 7 | // 8 | #import "UILabel+LXAdd.h" 9 | #import 10 | #import 11 | 12 | 13 | @implementation UILabel (LXAdd) 14 | 15 | -(CGFloat)characterSpace{ 16 | return [objc_getAssociatedObject(self,_cmd) floatValue]; 17 | } 18 | 19 | -(void)setCharacterSpace:(CGFloat)characterSpace{ 20 | objc_setAssociatedObject(self, @selector(characterSpace), @(characterSpace), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 21 | 22 | } 23 | 24 | -(CGFloat)lineSpace{ 25 | return [objc_getAssociatedObject(self, _cmd) floatValue]; 26 | } 27 | 28 | -(void)setLineSpace:(CGFloat)lineSpace{ 29 | objc_setAssociatedObject(self, @selector(lineSpace), @(lineSpace), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 30 | } 31 | 32 | 33 | -(NSString *)keywords{ 34 | return objc_getAssociatedObject(self, _cmd); 35 | } 36 | 37 | -(void)setKeywords:(NSString *)keywords{ 38 | objc_setAssociatedObject(self, @selector(keywords), keywords, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 39 | } 40 | 41 | -(UIFont *)keywordsFont{ 42 | return objc_getAssociatedObject(self, _cmd); 43 | } 44 | 45 | -(void)setKeywordsFont:(UIFont *)keywordsFont{ 46 | objc_setAssociatedObject(self, @selector(keywordsFont), keywordsFont, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 47 | } 48 | 49 | -(UIColor *)keywordsColor{ 50 | return objc_getAssociatedObject(self, _cmd); 51 | } 52 | 53 | -(void)setKeywordsColor:(UIColor *)keywordsColor{ 54 | objc_setAssociatedObject(self, @selector(keywordsColor), keywordsColor, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 55 | } 56 | 57 | -(NSString *)underlineStr{ 58 | return objc_getAssociatedObject(self, _cmd); 59 | } 60 | 61 | -(void)setUnderlineStr:(NSString *)underlineStr{ 62 | objc_setAssociatedObject(self, @selector(underlineStr), underlineStr, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 63 | 64 | } 65 | 66 | -(UIColor *)underlineColor{ 67 | return objc_getAssociatedObject(self, _cmd); 68 | } 69 | 70 | -(void)setUnderlineColor:(UIColor *)underlineColor{ 71 | objc_setAssociatedObject(self, @selector(underlineColor), underlineColor, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 72 | 73 | } 74 | 75 | /** 76 | * 根据最大宽度计算label宽,高 77 | * 78 | * @param maxWidth 最大宽度 79 | * 80 | * @return rect 81 | */ 82 | - (CGSize)getLableRectWithMaxWidth:(CGFloat)maxWidth{ 83 | 84 | NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:self.text]; 85 | [attributedString addAttribute:NSFontAttributeName value:self.font range:NSMakeRange(0,self.text.length)]; 86 | 87 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init]; 88 | // paragraphStyle.alignment=NSTextAlignmentCenter; 89 | paragraphStyle.alignment=self.textAlignment; 90 | paragraphStyle.lineBreakMode=self.lineBreakMode; 91 | // 行间距 92 | if(self.lineSpace > 0){ 93 | [paragraphStyle setLineSpacing:self.lineSpace]; 94 | [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0,self.text.length)]; 95 | } 96 | 97 | // 字间距 98 | if(self.characterSpace > 0){ 99 | long number = self.characterSpace; 100 | CFNumberRef num = CFNumberCreate(kCFAllocatorDefault,kCFNumberSInt8Type,&number); 101 | [attributedString addAttribute:(id)kCTKernAttributeName value:(__bridge id)num range:NSMakeRange(0,[attributedString length])]; 102 | 103 | CFRelease(num); 104 | } 105 | 106 | //关键字 107 | if (self.keywords) { 108 | NSRange itemRange = [self.text rangeOfString:self.keywords]; 109 | if (self.keywordsFont) { 110 | [attributedString addAttribute:NSFontAttributeName value:self.keywordsFont range:itemRange]; 111 | 112 | } 113 | 114 | if (self.keywordsColor) { 115 | [attributedString addAttribute:NSForegroundColorAttributeName value:self.keywordsColor range:itemRange]; 116 | 117 | } 118 | } 119 | 120 | //下划线 121 | if (self.underlineStr) { 122 | NSRange itemRange = [self.text rangeOfString:self.underlineStr]; 123 | [attributedString addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:itemRange]; 124 | if (self.underlineColor) { 125 | [attributedString addAttribute:NSUnderlineColorAttributeName value:self.underlineColor range:itemRange]; 126 | } 127 | } 128 | 129 | 130 | 131 | self.attributedText = attributedString; 132 | 133 | //计算方法一 134 | //计算文本rect,但是发现设置paragraphStyle.lineBreakMode=NSLineBreakByTruncatingTail;后高度计算不准确 135 | 136 | // CGRect rect = [attributedString boundingRectWithSize:CGSizeMake(maxWidth, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil]; 137 | // NSLog(@"rect==%@,%f",NSStringFromCGRect(rect),ceil(rect.size.height)); 138 | 139 | //计算方法二 140 | CGSize maximumLabelSize = CGSizeMake(maxWidth, MAXFLOAT);//labelsize的最大值 141 | CGSize expectSize = [self sizeThatFits:maximumLabelSize]; 142 | return expectSize; 143 | } 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | @end 152 | -------------------------------------------------------------------------------- /LXAlertViewDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LXAlertViewDemo 4 | // 5 | // Created by 刘鑫 on 16/4/15. 6 | // Copyright © 2016年 liuxin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LXAlertViewDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LXAlertViewDemo 4 | // 5 | // Created by 刘鑫 on 16/4/15. 6 | // Copyright © 2016年 liuxin. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "LXAlertView.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | 22 | 23 | } 24 | 25 | - (void)didReceiveMemoryWarning { 26 | [super didReceiveMemoryWarning]; 27 | // Dispose of any resources that can be recreated. 28 | } 29 | - (IBAction)myAlertClick:(id)sender { 30 | 31 | LXAlertView *alert=[[LXAlertView alloc] initWithTitle:@"提示" message:@"自定义alertview,可以自动适应文字内容。" cancelBtnTitle:@"取消" otherBtnTitle:@"确定" clickIndexBlock:^(NSInteger clickIndex) { 32 | NSLog(@"点击index====%ld",clickIndex); 33 | }]; 34 | //alert.dontDissmiss=YES; 35 | //设置动画类型(默认是缩放) 36 | //_alert.animationStyle=LXASAnimationTopShake; 37 | [alert showLXAlertView]; 38 | 39 | } 40 | - (IBAction)animation2:(id)sender { 41 | LXAlertView *alert=[[LXAlertView alloc] initWithTitle:@"提示" message:@"自定义alertview,可以自动适应文字内容。" cancelBtnTitle:@"取消" otherBtnTitle:@"确定" clickIndexBlock:^(NSInteger clickIndex) { 42 | NSLog(@"点击index====%ld",clickIndex); 43 | }]; 44 | alert.animationStyle=LXASAnimationTopShake; 45 | [alert showLXAlertView]; 46 | } 47 | - (IBAction)animation3:(id)sender { 48 | LXAlertView *alert=[[LXAlertView alloc] initWithTitle:@"提示" message:@"自定义alertview,可以自动适应文字内容。" cancelBtnTitle:@"取消" otherBtnTitle:@"确定" clickIndexBlock:^(NSInteger clickIndex) { 49 | NSLog(@"点击index====%ld",clickIndex); 50 | }]; 51 | alert.animationStyle=LXASAnimationLeftShake; 52 | [alert showLXAlertView]; 53 | } 54 | 55 | - (IBAction)systemAlertClick:(id)sender { 56 | UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"提示" message:@"系统的alert" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil]; 57 | [alert show]; 58 | 59 | } 60 | 61 | - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ 62 | NSLog(@"系统alert==%ld",buttonIndex); 63 | } 64 | 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /LXAlertViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LXAlertViewDemo 4 | // 5 | // Created by 刘鑫 on 16/4/15. 6 | // Copyright © 2016年 liuxin. 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 | -------------------------------------------------------------------------------- /LXAlertViewDemoTests/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LXAlertViewDemoTests/LXAlertViewDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LXAlertViewDemoTests.m 3 | // LXAlertViewDemoTests 4 | // 5 | // Created by 刘鑫 on 16/4/15. 6 | // Copyright © 2016年 liuxin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LXAlertViewDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LXAlertViewDemoTests 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 | -------------------------------------------------------------------------------- /LXAlertViewDemoUITests/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LXAlertViewDemoUITests/LXAlertViewDemoUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LXAlertViewDemoUITests.m 3 | // LXAlertViewDemoUITests 4 | // 5 | // Created by 刘鑫 on 16/4/15. 6 | // Copyright © 2016年 liuxin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LXAlertViewDemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LXAlertViewDemoUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LXAlertViewDemo 2 | * 一款AlertView提示框,高度可根据内容自适应。 3 | 4 | --- 5 | #####本控件[项目地址](https://github.com/xinge1/LXAlertViewDemo),希望能给个start,欢迎大家交流指正。 6 |
7 | --- 8 | ######简单说明 9 | 有简单动画效果,高度可根据内容自适应,点击事件采用block回调。如果项目有强制更新的需求可以设置点击按钮AlertView不消失 10 |
11 | 12 | 效果图
13 | ![](http://upload-images.jianshu.io/upload_images/292993-64876408eb4e9ad1.gif?imageMogr2/auto-orient/strip) 14 | 15 | ###使用方法 16 | ####1.导入
17 | ```#import "LXAlertView.h"``` 18 | ####2.初始化方法
19 | ``` 20 | LXAlertView *alert=[[LXAlertView alloc] initWithTitle:@"提示" message:@"自定义alertview,可以自动适应文字内容。" cancelBtnTitle:@"取消" otherBtnTitle:@"确定" clickIndexBlock:^(NSInteger clickIndex) { 21 | NSLog(@"点击index====%ld",clickIndex); 22 | }]; 23 | [alert showLXAlertView]; 24 | 25 | ``` 26 | --- 27 | [简书地址](http://www.jianshu.com/p/8706725bcc8a) 28 | --------------------------------------------------------------------------------