├── Alert.podspec ├── Alert ├── Alert.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ ├── OS.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── whde.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ ├── OS.xcuserdatad │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ └── whde.xcuserdatad │ │ └── xcschemes │ │ ├── Alert.xcscheme │ │ ├── AlertTarget.xcscheme │ │ └── xcschememanagement.plist ├── Alert │ ├── AlertView │ │ ├── Alert.h │ │ ├── Alert.m │ │ └── s.png │ └── Info.plist ├── B902C6B8-0C75-43F7-BE1C-B7485F440541.png ├── CA246576-E925-4195-B0D6-072E7FC1F3D6.jpeg ├── Products │ └── Alert.framework │ │ ├── Alert │ │ ├── Headers │ │ └── Alert.h │ │ ├── Info.plist │ │ └── Modules │ │ └── module.modulemap ├── Untitled.gif └── 未命名.mov ├── AlertDemo ├── AlertDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ ├── OS.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── whde.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ ├── OS.xcuserdatad │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ └── whde.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── AlertDemo.xcscheme │ │ └── xcschememanagement.plist ├── AlertDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-29.0@1x.png │ │ │ ├── Icon-29.0@2x.png │ │ │ ├── Icon-29.0@3x.png │ │ │ ├── Icon-40.0@1x.png │ │ │ ├── Icon-40.0@2x.png │ │ │ ├── Icon-40.0@3x.png │ │ │ ├── Icon-60.0@2x.png │ │ │ ├── Icon-60.0@3x.png │ │ │ ├── Icon-76.0@1x.png │ │ │ ├── Icon-76.0@2x.png │ │ │ └── Icon-83.5@2x.png │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── ScreenShot_20160401_111507.png ├── ScreenShot_20160401_111540.png ├── ScreenShot_20160401_111552.png ├── ScreenShot_20160401_111558.png ├── ScreenShot_20160401_111606.png ├── ScreenShot_20160401_111611.png ├── ScreenShot_20160401_111619.png ├── ScreenShot_20160401_111624.png ├── ScreenShot_20160401_111645.png ├── ScreenShot_20160401_111651.png ├── ScreenShot_20160401_111707.png ├── ScreenShot_20160401_111712.png ├── ScreenShot_20160401_111719.png └── ScreenShot_20160401_111726.png ├── LICENSE └── README.md /Alert.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "Alert" 3 | s.version = "1.0.5" 4 | s.summary = "iOS AlertView." 5 | s.homepage = "https://github.com/whde/Alert" 6 | s.license = 'MIT' 7 | s.author = { "Whde" => "460290973@qq.com" } 8 | s.platform = :ios, "7.0" 9 | s.source = { :git => "https://github.com/whde/Alert.git", :tag => s.version.to_s } 10 | s.source_files = 'Alert/Alert/AlertView/*{h,m}' 11 | s.frameworks = 'Foundation', 'CoreGraphics', 'UIKit' 12 | s.requires_arc = true 13 | s.description = <<-DESC 14 | It is a Alert view used on iOS, which implement by Objective-C, Support iOS 11. 15 | DESC 16 | end 17 | -------------------------------------------------------------------------------- /Alert/Alert.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXAggregateTarget section */ 10 | F83448F91C462EAA00D224E5 /* AlertTarget */ = { 11 | isa = PBXAggregateTarget; 12 | buildConfigurationList = F83448FA1C462EAA00D224E5 /* Build configuration list for PBXAggregateTarget "AlertTarget" */; 13 | buildPhases = ( 14 | F83448FD1C462EB000D224E5 /* ShellScript */, 15 | ); 16 | dependencies = ( 17 | ); 18 | name = AlertTarget; 19 | productName = AlertTarget; 20 | }; 21 | /* End PBXAggregateTarget section */ 22 | 23 | /* Begin PBXBuildFile section */ 24 | F83449021C462F1900D224E5 /* Alert.h in Headers */ = {isa = PBXBuildFile; fileRef = F83448FF1C462F1900D224E5 /* Alert.h */; settings = {ATTRIBUTES = (Public, ); }; }; 25 | F83449031C462F1900D224E5 /* Alert.m in Sources */ = {isa = PBXBuildFile; fileRef = F83449001C462F1900D224E5 /* Alert.m */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | F83448EE1C462E8900D224E5 /* Alert.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Alert.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | F83448F31C462E8900D224E5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | F83448FF1C462F1900D224E5 /* Alert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Alert.h; sourceTree = ""; }; 32 | F83449001C462F1900D224E5 /* Alert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Alert.m; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | F83448EA1C462E8900D224E5 /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | /* End PBXFrameworksBuildPhase section */ 44 | 45 | /* Begin PBXGroup section */ 46 | F83448E41C462E8900D224E5 = { 47 | isa = PBXGroup; 48 | children = ( 49 | F83448F01C462E8900D224E5 /* Alert */, 50 | F83448EF1C462E8900D224E5 /* Products */, 51 | ); 52 | sourceTree = ""; 53 | }; 54 | F83448EF1C462E8900D224E5 /* Products */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | F83448EE1C462E8900D224E5 /* Alert.framework */, 58 | ); 59 | name = Products; 60 | sourceTree = ""; 61 | }; 62 | F83448F01C462E8900D224E5 /* Alert */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | F83448FE1C462F1900D224E5 /* AlertView */, 66 | F83448F31C462E8900D224E5 /* Info.plist */, 67 | ); 68 | path = Alert; 69 | sourceTree = ""; 70 | }; 71 | F83448FE1C462F1900D224E5 /* AlertView */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | F83448FF1C462F1900D224E5 /* Alert.h */, 75 | F83449001C462F1900D224E5 /* Alert.m */, 76 | ); 77 | path = AlertView; 78 | sourceTree = ""; 79 | }; 80 | /* End PBXGroup section */ 81 | 82 | /* Begin PBXHeadersBuildPhase section */ 83 | F83448EB1C462E8900D224E5 /* Headers */ = { 84 | isa = PBXHeadersBuildPhase; 85 | buildActionMask = 2147483647; 86 | files = ( 87 | F83449021C462F1900D224E5 /* Alert.h in Headers */, 88 | ); 89 | runOnlyForDeploymentPostprocessing = 0; 90 | }; 91 | /* End PBXHeadersBuildPhase section */ 92 | 93 | /* Begin PBXNativeTarget section */ 94 | F83448ED1C462E8900D224E5 /* Alert */ = { 95 | isa = PBXNativeTarget; 96 | buildConfigurationList = F83448F61C462E8900D224E5 /* Build configuration list for PBXNativeTarget "Alert" */; 97 | buildPhases = ( 98 | F83448E91C462E8900D224E5 /* Sources */, 99 | F83448EA1C462E8900D224E5 /* Frameworks */, 100 | F83448EB1C462E8900D224E5 /* Headers */, 101 | F83448EC1C462E8900D224E5 /* Resources */, 102 | ); 103 | buildRules = ( 104 | ); 105 | dependencies = ( 106 | ); 107 | name = Alert; 108 | productName = Alert; 109 | productReference = F83448EE1C462E8900D224E5 /* Alert.framework */; 110 | productType = "com.apple.product-type.framework"; 111 | }; 112 | /* End PBXNativeTarget section */ 113 | 114 | /* Begin PBXProject section */ 115 | F83448E51C462E8900D224E5 /* Project object */ = { 116 | isa = PBXProject; 117 | attributes = { 118 | LastUpgradeCheck = 0920; 119 | ORGANIZATIONNAME = Whde; 120 | TargetAttributes = { 121 | F83448ED1C462E8900D224E5 = { 122 | CreatedOnToolsVersion = 7.2; 123 | }; 124 | F83448F91C462EAA00D224E5 = { 125 | CreatedOnToolsVersion = 7.2; 126 | }; 127 | }; 128 | }; 129 | buildConfigurationList = F83448E81C462E8900D224E5 /* Build configuration list for PBXProject "Alert" */; 130 | compatibilityVersion = "Xcode 3.2"; 131 | developmentRegion = English; 132 | hasScannedForEncodings = 0; 133 | knownRegions = ( 134 | en, 135 | ); 136 | mainGroup = F83448E41C462E8900D224E5; 137 | productRefGroup = F83448EF1C462E8900D224E5 /* Products */; 138 | projectDirPath = ""; 139 | projectRoot = ""; 140 | targets = ( 141 | F83448ED1C462E8900D224E5 /* Alert */, 142 | F83448F91C462EAA00D224E5 /* AlertTarget */, 143 | ); 144 | }; 145 | /* End PBXProject section */ 146 | 147 | /* Begin PBXResourcesBuildPhase section */ 148 | F83448EC1C462E8900D224E5 /* Resources */ = { 149 | isa = PBXResourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | ); 153 | runOnlyForDeploymentPostprocessing = 0; 154 | }; 155 | /* End PBXResourcesBuildPhase section */ 156 | 157 | /* Begin PBXShellScriptBuildPhase section */ 158 | F83448FD1C462EB000D224E5 /* ShellScript */ = { 159 | isa = PBXShellScriptBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | ); 163 | inputPaths = ( 164 | ); 165 | outputPaths = ( 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | shellPath = /bin/sh; 169 | shellScript = "# Sets the target folders and the final framework product.\n# 如果工程名称和Framework的Target名称不一样的话,要自定义FMKNAME\n# 例如: FMK_NAME = \"MyFramework\"\nFMK_NAME=${PROJECT_NAME}\n# Install dir will be the final output to the framework.\n# The following line create it in the root folder of the current project.\nINSTALL_DIR=${SRCROOT}/Products/${FMK_NAME}.framework\n# Working dir will be deleted after the framework creation.\nWRK_DIR=build\nDEVICE_DIR=${WRK_DIR}/Release-iphoneos/${FMK_NAME}.framework\nSIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator/${FMK_NAME}.framework\n# -configuration ${CONFIGURATION}\n# Clean and Building both architectures.\nxcodebuild -configuration \"Release\" -target \"${FMK_NAME}\" -sdk iphoneos clean build\nxcodebuild -configuration \"Release\" -target \"${FMK_NAME}\" -sdk iphonesimulator clean build\n# Cleaning the oldest.\nif [ -d \"${INSTALL_DIR}\" ]\nthen\nrm -rf \"${INSTALL_DIR}\"\nfi\nmkdir -p \"${INSTALL_DIR}\"\ncp -R \"${DEVICE_DIR}/\" \"${INSTALL_DIR}/\"\n# Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.\nlipo -create \"${DEVICE_DIR}/${FMK_NAME}\" \"${SIMULATOR_DIR}/${FMK_NAME}\" -output \"${INSTALL_DIR}/${FMK_NAME}\"\nrm -r \"${WRK_DIR}\"\nopen \"${INSTALL_DIR}\""; 170 | }; 171 | /* End PBXShellScriptBuildPhase section */ 172 | 173 | /* Begin PBXSourcesBuildPhase section */ 174 | F83448E91C462E8900D224E5 /* Sources */ = { 175 | isa = PBXSourcesBuildPhase; 176 | buildActionMask = 2147483647; 177 | files = ( 178 | F83449031C462F1900D224E5 /* Alert.m in Sources */, 179 | ); 180 | runOnlyForDeploymentPostprocessing = 0; 181 | }; 182 | /* End PBXSourcesBuildPhase section */ 183 | 184 | /* Begin XCBuildConfiguration section */ 185 | F83448F41C462E8900D224E5 /* Debug */ = { 186 | isa = XCBuildConfiguration; 187 | buildSettings = { 188 | ALWAYS_SEARCH_USER_PATHS = NO; 189 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 190 | CLANG_CXX_LIBRARY = "libc++"; 191 | CLANG_ENABLE_MODULES = YES; 192 | CLANG_ENABLE_OBJC_ARC = YES; 193 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 194 | CLANG_WARN_BOOL_CONVERSION = YES; 195 | CLANG_WARN_COMMA = YES; 196 | CLANG_WARN_CONSTANT_CONVERSION = YES; 197 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 198 | CLANG_WARN_EMPTY_BODY = YES; 199 | CLANG_WARN_ENUM_CONVERSION = YES; 200 | CLANG_WARN_INFINITE_RECURSION = YES; 201 | CLANG_WARN_INT_CONVERSION = YES; 202 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 203 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 204 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 205 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 206 | CLANG_WARN_STRICT_PROTOTYPES = YES; 207 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 208 | CLANG_WARN_UNREACHABLE_CODE = YES; 209 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 210 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 211 | COPY_PHASE_STRIP = NO; 212 | CURRENT_PROJECT_VERSION = 1; 213 | DEBUG_INFORMATION_FORMAT = dwarf; 214 | ENABLE_STRICT_OBJC_MSGSEND = YES; 215 | ENABLE_TESTABILITY = YES; 216 | GCC_C_LANGUAGE_STANDARD = gnu99; 217 | GCC_DYNAMIC_NO_PIC = NO; 218 | GCC_NO_COMMON_BLOCKS = YES; 219 | GCC_OPTIMIZATION_LEVEL = 0; 220 | GCC_PREPROCESSOR_DEFINITIONS = ( 221 | "DEBUG=1", 222 | "$(inherited)", 223 | ); 224 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 225 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 226 | GCC_WARN_UNDECLARED_SELECTOR = YES; 227 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 228 | GCC_WARN_UNUSED_FUNCTION = YES; 229 | GCC_WARN_UNUSED_VARIABLE = YES; 230 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 231 | MTL_ENABLE_DEBUG_INFO = YES; 232 | ONLY_ACTIVE_ARCH = YES; 233 | SDKROOT = iphoneos; 234 | TARGETED_DEVICE_FAMILY = "1,2"; 235 | VERSIONING_SYSTEM = "apple-generic"; 236 | VERSION_INFO_PREFIX = ""; 237 | }; 238 | name = Debug; 239 | }; 240 | F83448F51C462E8900D224E5 /* Release */ = { 241 | isa = XCBuildConfiguration; 242 | buildSettings = { 243 | ALWAYS_SEARCH_USER_PATHS = NO; 244 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 245 | CLANG_CXX_LIBRARY = "libc++"; 246 | CLANG_ENABLE_MODULES = YES; 247 | CLANG_ENABLE_OBJC_ARC = YES; 248 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 249 | CLANG_WARN_BOOL_CONVERSION = YES; 250 | CLANG_WARN_COMMA = YES; 251 | CLANG_WARN_CONSTANT_CONVERSION = YES; 252 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 253 | CLANG_WARN_EMPTY_BODY = YES; 254 | CLANG_WARN_ENUM_CONVERSION = YES; 255 | CLANG_WARN_INFINITE_RECURSION = YES; 256 | CLANG_WARN_INT_CONVERSION = YES; 257 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 258 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 259 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 260 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 261 | CLANG_WARN_STRICT_PROTOTYPES = YES; 262 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 263 | CLANG_WARN_UNREACHABLE_CODE = YES; 264 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 265 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 266 | COPY_PHASE_STRIP = NO; 267 | CURRENT_PROJECT_VERSION = 1; 268 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 269 | ENABLE_NS_ASSERTIONS = NO; 270 | ENABLE_STRICT_OBJC_MSGSEND = YES; 271 | GCC_C_LANGUAGE_STANDARD = gnu99; 272 | GCC_NO_COMMON_BLOCKS = YES; 273 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 274 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 275 | GCC_WARN_UNDECLARED_SELECTOR = YES; 276 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 277 | GCC_WARN_UNUSED_FUNCTION = YES; 278 | GCC_WARN_UNUSED_VARIABLE = YES; 279 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 280 | MTL_ENABLE_DEBUG_INFO = NO; 281 | SDKROOT = iphoneos; 282 | TARGETED_DEVICE_FAMILY = "1,2"; 283 | VALIDATE_PRODUCT = YES; 284 | VERSIONING_SYSTEM = "apple-generic"; 285 | VERSION_INFO_PREFIX = ""; 286 | }; 287 | name = Release; 288 | }; 289 | F83448F71C462E8900D224E5 /* Debug */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | CODE_SIGN_IDENTITY = "iPhone Developer"; 293 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 294 | DEFINES_MODULE = YES; 295 | DYLIB_COMPATIBILITY_VERSION = 1; 296 | DYLIB_CURRENT_VERSION = 1; 297 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 298 | ENABLE_BITCODE = NO; 299 | INFOPLIST_FILE = Alert/Info.plist; 300 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 301 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 302 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 303 | MACH_O_TYPE = staticlib; 304 | PRODUCT_BUNDLE_IDENTIFIER = com.videojet.Alert; 305 | PRODUCT_NAME = "$(TARGET_NAME)"; 306 | SKIP_INSTALL = YES; 307 | }; 308 | name = Debug; 309 | }; 310 | F83448F81C462E8900D224E5 /* Release */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | CODE_SIGN_IDENTITY = "iPhone Developer"; 314 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 315 | DEFINES_MODULE = YES; 316 | DYLIB_COMPATIBILITY_VERSION = 1; 317 | DYLIB_CURRENT_VERSION = 1; 318 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 319 | ENABLE_BITCODE = NO; 320 | INFOPLIST_FILE = Alert/Info.plist; 321 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 322 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 323 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 324 | MACH_O_TYPE = staticlib; 325 | PRODUCT_BUNDLE_IDENTIFIER = com.videojet.Alert; 326 | PRODUCT_NAME = "$(TARGET_NAME)"; 327 | SKIP_INSTALL = YES; 328 | }; 329 | name = Release; 330 | }; 331 | F83448FB1C462EAA00D224E5 /* Debug */ = { 332 | isa = XCBuildConfiguration; 333 | buildSettings = { 334 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 335 | MACH_O_TYPE = staticlib; 336 | PRODUCT_NAME = "$(TARGET_NAME)"; 337 | }; 338 | name = Debug; 339 | }; 340 | F83448FC1C462EAA00D224E5 /* Release */ = { 341 | isa = XCBuildConfiguration; 342 | buildSettings = { 343 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 344 | MACH_O_TYPE = staticlib; 345 | PRODUCT_NAME = "$(TARGET_NAME)"; 346 | }; 347 | name = Release; 348 | }; 349 | /* End XCBuildConfiguration section */ 350 | 351 | /* Begin XCConfigurationList section */ 352 | F83448E81C462E8900D224E5 /* Build configuration list for PBXProject "Alert" */ = { 353 | isa = XCConfigurationList; 354 | buildConfigurations = ( 355 | F83448F41C462E8900D224E5 /* Debug */, 356 | F83448F51C462E8900D224E5 /* Release */, 357 | ); 358 | defaultConfigurationIsVisible = 0; 359 | defaultConfigurationName = Release; 360 | }; 361 | F83448F61C462E8900D224E5 /* Build configuration list for PBXNativeTarget "Alert" */ = { 362 | isa = XCConfigurationList; 363 | buildConfigurations = ( 364 | F83448F71C462E8900D224E5 /* Debug */, 365 | F83448F81C462E8900D224E5 /* Release */, 366 | ); 367 | defaultConfigurationIsVisible = 0; 368 | defaultConfigurationName = Release; 369 | }; 370 | F83448FA1C462EAA00D224E5 /* Build configuration list for PBXAggregateTarget "AlertTarget" */ = { 371 | isa = XCConfigurationList; 372 | buildConfigurations = ( 373 | F83448FB1C462EAA00D224E5 /* Debug */, 374 | F83448FC1C462EAA00D224E5 /* Release */, 375 | ); 376 | defaultConfigurationIsVisible = 0; 377 | defaultConfigurationName = Release; 378 | }; 379 | /* End XCConfigurationList section */ 380 | }; 381 | rootObject = F83448E51C462E8900D224E5 /* Project object */; 382 | } 383 | -------------------------------------------------------------------------------- /Alert/Alert.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Alert/Alert.xcodeproj/project.xcworkspace/xcuserdata/OS.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/Alert/Alert.xcodeproj/project.xcworkspace/xcuserdata/OS.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Alert/Alert.xcodeproj/project.xcworkspace/xcuserdata/whde.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/Alert/Alert.xcodeproj/project.xcworkspace/xcuserdata/whde.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Alert/Alert.xcodeproj/xcuserdata/OS.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Alert.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | AlertTarget.xcscheme 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Alert/Alert.xcodeproj/xcuserdata/whde.xcuserdatad/xcschemes/Alert.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /Alert/Alert.xcodeproj/xcuserdata/whde.xcuserdatad/xcschemes/AlertTarget.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /Alert/Alert.xcodeproj/xcuserdata/whde.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Alert.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | AlertTarget.xcscheme 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | F83448ED1C462E8900D224E5 21 | 22 | primary 23 | 24 | 25 | F83448F91C462EAA00D224E5 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Alert/Alert/AlertView/Alert.h: -------------------------------------------------------------------------------- 1 | // 2 | // Alert.h 3 | // test 4 | // 5 | // Created by Whde on 14/12/22. 6 | // Copyright (c) 2014年 whde. All rights reserved. 7 | // 8 | // GitHub:https://github.com/whde/Alert 9 | #import 10 | #define DEFAULT_LINE_SPACING (int)0 11 | #define DEFAULT_PARAGRAPH_SPACING (int)3 12 | 13 | typedef NS_ENUM(NSInteger, AlertStyle) { 14 | AlertStyleDefault = 0, 15 | AlertStyleSecureTextInput, 16 | AlertStylePlainTextInput, 17 | AlertStyleLoginAndPasswordInput 18 | }; 19 | @class Alert; 20 | @protocol AlertDelegate; 21 | 22 | @interface Alert : UIView { 23 | UITextView *_messageLabel; 24 | UILabel *_titleLabel; 25 | } 26 | @property (nonatomic, retain) id object; 27 | // delegate 28 | @property (nonatomic, assign, readonly) iddelegate; 29 | 30 | // alertView 31 | @property (nonatomic, strong, readonly) UIView *alertView; 32 | 33 | // 内容文字大小 34 | @property (nonatomic, strong) UIFont *font; 35 | 36 | // 设置message的对齐方式 37 | @property (nonatomic, assign) NSTextAlignment contentAlignment; 38 | 39 | // Alert TextInput LoginInput 40 | @property (nonatomic, strong) UITextField *textField; 41 | 42 | // Alert PasswordInput 43 | @property (nonatomic, strong) UITextField *passwordTextField; 44 | 45 | @property (nonatomic, assign) CGFloat lineSpacing; // DEFAULT_LINE_SPACING 46 | @property (nonatomic, assign) CGFloat paragraphSpacing; // DEFAULT_PARAGRAPH_SPACING 47 | @property (nonatomic, assign) AlertStyle alertStyle; // DEFAULT_PARAGRAPH_SPACING 48 | 49 | #pragma mark - --block 50 | typedef void (^CancelAlertBlock)(Alert *alertView) ; 51 | typedef void (^ClicksAlertBlock)(Alert *alertView, NSInteger buttonIndex); 52 | @property (nonatomic, copy, readonly) CancelAlertBlock cancelBlock; 53 | @property (nonatomic, copy, readonly) ClicksAlertBlock clickBlock; 54 | - (void)setCancelBlock:(CancelAlertBlock)cancelBlock; 55 | - (void)setClickBlock:(ClicksAlertBlock)clickBlock; 56 | 57 | #pragma mark - --init 58 | 59 | /** 60 | * 创建alertView 61 | * 62 | * @param title 提示标题 63 | * @param message 提示详情 64 | * @param delegate 协议对象 65 | * @param cancelButtonTitle 取消按钮名称 66 | * @param otherButtonTitles 其他按钮 67 | * 68 | * @return Alert Alert * 69 | */ 70 | - (instancetype)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...NS_REQUIRES_NIL_TERMINATION; 71 | 72 | /** 73 | * 显示alertView 74 | */ 75 | - (void)show; 76 | @end 77 | 78 | #pragma mark - --delegate 79 | @protocol AlertDelegate 80 | 81 | @optional 82 | /** 83 | * 点击按钮协议 84 | * 85 | * @param alertView Alert * 86 | * @param buttonIndex 0,1,2... 87 | */ 88 | - (void)alertView:(Alert *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex; 89 | 90 | /** 91 | * 取消协议 92 | * 93 | * @param alertView Alert * 94 | */ 95 | - (void)alertViewCancel:(Alert *)alertView; 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /Alert/Alert/AlertView/Alert.m: -------------------------------------------------------------------------------- 1 | // 2 | // Alert.m 3 | // test 4 | // 5 | // Created by Whde on 14/12/22. 6 | // Copyright (c) 2014年 whde. All rights reserved. 7 | // 8 | 9 | #import "Alert.h" 10 | 11 | 12 | @interface Alert() 13 | 14 | @end 15 | 16 | @implementation Alert{ 17 | BOOL hasCancelBtn; 18 | NSMutableArray *argsArray; 19 | NSString *titleText; 20 | NSString *messageText; 21 | } 22 | 23 | - (UIImage *)getiImage { 24 | static UIImage *image_s = nil; 25 | if (image_s) { 26 | return image_s; 27 | } else { 28 | NSUInteger image_s_ByteLen = 513; 29 | Byte *image_s_Bytes=(Byte []){0x89,0x50,0x4E,0x47,0xD,0xA,0x1A,0xA,0x0,0x0,0x0,0xD,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x28,0x0,0x0,0x0,0x28,0x8,0x3,0x0,0x0,0x0,0xBB,0x20,0x48,0x5F,0x0,0x0,0x0,0x36,0x50,0x4C,0x54,0x45,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xFF,0x7F,0x46,0xF,0xC7,0xA5,0x2B,0x0,0x0,0x0,0x11,0x74,0x52,0x4E,0x53,0x30,0x70,0xB0,0xC0,0xF0,0x80,0x0,0x10,0xE0,0x90,0x20,0xA0,0x40,0x50,0x60,0xD0,0x64,0xEB,0x4D,0xCA,0x6F,0x0,0x0,0x1,0x69,0x49,0x44,0x41,0x54,0x78,0x5E,0x8D,0xD4,0xEB,0xAE,0xC3,0x20,0x8,0x0,0x60,0xAC,0xF7,0xFB,0xE1,0xFD,0x5F,0xF6,0x14,0xA9,0x99,0xCA,0xD2,0x8C,0x3F,0x4B,0xF5,0xB,0x5,0x59,0x5,0xB7,0x5,0xA8,0x4B,0x1B,0x44,0xD4,0x97,0x3D,0x76,0x56,0xE8,0x6D,0xC0,0x25,0x4C,0x4C,0x2,0x32,0x33,0x78,0x46,0xF6,0x12,0x96,0xC0,0x40,0x47,0x5B,0x8B,0xB5,0x9A,0xA5,0xA9,0x27,0x54,0xAC,0xDA,0x27,0x45,0xBD,0x38,0xE9,0xE,0x33,0xB1,0x5E,0xDC,0x16,0x49,0xB3,0x5C,0x60,0x24,0x67,0x9D,0x8,0x65,0x58,0x4E,0xD8,0xA8,0x9A,0xE6,0xBE,0x4,0x90,0x8C,0x13,0x26,0x7A,0xAA,0x4B,0xFB,0x36,0xED,0xB2,0x3C,0x90,0x4A,0x59,0xF2,0x75,0x44,0xE3,0x3F,0xF2,0x86,0xC1,0xF,0x58,0x6F,0x77,0x2D,0x2D,0x20,0xE7,0x98,0x61,0xB9,0x7C,0x58,0x33,0x70,0x50,0x21,0xEB,0x4C,0xC2,0xD8,0x7,0x7,0x67,0xC3,0x55,0xEB,0xAD,0xB1,0x32,0x2A,0x3,0x17,0x8F,0x84,0x32,0x2,0xA2,0x76,0x40,0x3F,0x79,0x5,0xE9,0x4F,0x29,0xC5,0x62,0x99,0x9A,0x87,0xC4,0x47,0xB3,0x17,0x8F,0x1B,0x4,0xEA,0xE,0xA,0xF1,0x37,0xC8,0xED,0x59,0xB0,0x88,0x66,0x9F,0x70,0x17,0x50,0x23,0x46,0x82,0xFA,0x58,0x16,0xF0,0xBA,0xCD,0x4F,0xD0,0xFE,0xA,0xF3,0x3,0x83,0x84,0x62,0x25,0x43,0x15,0xCB,0x12,0x6,0xEA,0x7A,0x1C,0xD2,0x3B,0xF4,0x34,0x43,0xA0,0x43,0x8A,0xEF,0xB0,0xDD,0x30,0x1,0xF5,0x1E,0x5E,0x21,0xB,0x18,0xBE,0xBE,0xC1,0x34,0xBE,0x6,0x18,0x3,0xEA,0xE7,0x64,0x60,0x3F,0x1C,0x4C,0xE,0x78,0xB8,0xEA,0x98,0xB5,0xDE,0xFF,0x8E,0xD9,0x11,0xF4,0x1,0xD1,0xC0,0x77,0xC8,0xBB,0x98,0x8,0xF2,0x47,0x13,0xFC,0x77,0xE8,0xFB,0xF3,0x1,0xC0,0xAC,0xA2,0x93,0x14,0x41,0x8E,0x3B,0x80,0xF9,0xB8,0xBC,0xFD,0x68,0xCC,0xF8,0x7,0x4E,0x89,0xD6,0x8B,0x1B,0x85,0x13,0x30,0x5C,0x64,0x50,0x2B,0x6D,0x81,0xD6,0x3A,0x1C,0xF7,0x63,0xC4,0x11,0x97,0x2A,0x84,0x4B,0xCB,0x86,0x9F,0xBD,0xB8,0x71,0x4B,0x47,0x11,0xA1,0x7E,0xBD,0xC3,0xDB,0x42,0x45,0x25,0x7B,0xAB,0x60,0xF5,0x54,0x3D,0x1E,0x5B,0xF2,0x48,0xCA,0x1D,0x72,0xF9,0x1F,0x7C,0x7B,0x34,0xE7,0xA3,0x9B,0xB8,0x3F,0x0,0x0,0x0,0x0,0x49,0x45,0x4E,0x44,0xAE,0x42,0x60,0x82}; 30 | image_s = [[UIImage alloc] initWithData:[NSData dataWithBytes:image_s_Bytes length:image_s_ByteLen]]; 31 | return image_s; 32 | } 33 | } 34 | 35 | /** 36 | * 处理通知 37 | */ 38 | - (void)dealloc { 39 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 40 | } 41 | /** 42 | * 创建alertView 43 | * 44 | * @param title 提示标题 45 | * @param message 提示详情 46 | * @param delegate 协议对象 47 | * @param cancelButtonTitle 取消按钮名称 48 | * @param otherButtonTitles 其他按钮 49 | * 50 | * @return Alert 51 | */ 52 | - (instancetype)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;{ 53 | self = [super init]; 54 | if (self) { 55 | titleText = title; 56 | messageText = message; 57 | _lineSpacing = DEFAULT_LINE_SPACING; 58 | _paragraphSpacing = DEFAULT_LINE_SPACING; 59 | _contentAlignment = NSTextAlignmentCenter; 60 | _font = [UIFont systemFontOfSize:14]; 61 | _alertStyle = AlertStyleDefault; 62 | if (delegate){ 63 | _delegate = delegate; 64 | } 65 | argsArray = [[NSMutableArray alloc] init]; 66 | hasCancelBtn = NO; 67 | if (cancelButtonTitle) { 68 | hasCancelBtn = YES; 69 | [argsArray insertObject:cancelButtonTitle atIndex:0]; 70 | } 71 | va_list params; //定义一个指向个数可变的参数列表指针; 72 | va_start(params,otherButtonTitles);//va_start 得到第一个可变参数地址, 73 | id arg; 74 | if (otherButtonTitles) { 75 | //将第一个参数添加到array 76 | id prev = otherButtonTitles; 77 | [argsArray addObject:prev]; 78 | //va_arg 指向下一个参数地址 79 | //这里是问题的所在 网上的例子,没有保存第一个参数地址,后边循环,指针将不会在指向第一个参数 80 | while( (arg = va_arg(params,id)) ){ 81 | if ( arg ){ 82 | [argsArray addObject:arg]; 83 | } 84 | } 85 | //置空 86 | va_end(params); 87 | } 88 | } 89 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(needsDisplay) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; 90 | return self; 91 | } 92 | 93 | /** 94 | * 点击按钮 95 | */ 96 | - (void)buttonClick:(UIButton *)sender{ 97 | if (_delegate && [_delegate respondsToSelector:@selector(alertView:clickedButtonAtIndex:)]){ 98 | [_delegate alertView:self clickedButtonAtIndex:sender.tag]; 99 | } 100 | if (_clickBlock) { 101 | _clickBlock(self, sender.tag); 102 | } 103 | [self dismiss]; 104 | } 105 | 106 | /** 107 | * 点击取消按钮 108 | */ 109 | - (void)cancalClick:(UIButton *)sender{ 110 | if (_delegate && [_delegate respondsToSelector:@selector(alertViewCancel:)]) { 111 | [_delegate alertViewCancel:self]; 112 | } 113 | if (_cancelBlock) { 114 | if (_cancelBlock) { 115 | _cancelBlock(self); 116 | } 117 | } 118 | if (_delegate && [_delegate respondsToSelector:@selector(alertView:clickedButtonAtIndex:)]){ 119 | [_delegate alertView:self clickedButtonAtIndex:sender.tag]; 120 | } 121 | if (_clickBlock) { 122 | _clickBlock(self, sender.tag); 123 | } 124 | [self dismiss]; 125 | } 126 | 127 | /** 128 | * 显示alertView 129 | */ 130 | - (void)show { 131 | dispatch_async(dispatch_get_main_queue(), ^{ 132 | [self needsDisplay]; 133 | /*UIWindow *window = ((UIWindow *)[[UIApplication sharedApplication] windows][0]);*/ 134 | UIWindow *window = ((UIWindow *)[UIApplication sharedApplication].keyWindow); 135 | [window addSubview:self]; 136 | [window endEditing:YES]; 137 | [self performPresentationAnimation]; 138 | }); 139 | } 140 | 141 | /** 142 | * 隐藏AlertView 143 | */ 144 | - (void)dismiss { 145 | [self removeFromSuperview]; 146 | } 147 | 148 | /** 149 | * 点击空白处,不做操作 150 | */ 151 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 152 | [self.window resignFirstResponder]; 153 | } 154 | 155 | /** 156 | * 显示动画 157 | */ 158 | - (void)performPresentationAnimation{ 159 | CAKeyframeAnimation *bounceAnimation = [CAKeyframeAnimation animation]; 160 | bounceAnimation.duration = 0.3; 161 | bounceAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; 162 | bounceAnimation.values = [NSArray arrayWithObjects: 163 | [NSNumber numberWithFloat:0.8], 164 | [NSNumber numberWithFloat:1.05], 165 | [NSNumber numberWithFloat:0.98], 166 | [NSNumber numberWithFloat:1.0], 167 | nil]; 168 | 169 | [_alertView.layer addAnimation:bounceAnimation forKey:@"transform.scale"]; 170 | [UIView animateWithDuration:0.15 animations:^{ 171 | self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3]; 172 | }]; 173 | } 174 | 175 | /** 176 | * 设置message字体 177 | * 178 | * @param font UIFont 179 | */ 180 | - (void)setFont:(UIFont *)font{ 181 | _font = font; 182 | _messageLabel.font = font; 183 | } 184 | 185 | /** 186 | * 设置message的对齐方式 187 | * 188 | * @param contentAlignment NSTextAlignment 189 | */ 190 | - (void)setContentAlignment:(NSTextAlignment)contentAlignment{ 191 | _contentAlignment = contentAlignment; 192 | } 193 | 194 | /** 195 | * 设置行距 196 | * 197 | * @param lineSpacing CGFloat 198 | */ 199 | - (void)setLineSpacing:(CGFloat)lineSpacing{ 200 | _lineSpacing = lineSpacing; 201 | } 202 | 203 | /** 204 | * 这是段落间距 205 | * 206 | * @param paragraphSpacing CGFloat 207 | */ 208 | - (void)setParagraphSpacing:(CGFloat)paragraphSpacing{ 209 | _paragraphSpacing = paragraphSpacing; 210 | } 211 | 212 | /*! 213 | * 设置Alert的类型 214 | * @param alertStyle AlertStyle 215 | */ 216 | - (void)setAlertStyle:(AlertStyle)alertStyle { 217 | _alertStyle = alertStyle; 218 | void (^addKeybordNotification)(void)= ^(){ 219 | // 键盘通知 220 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBoardWillShow:) name:UIKeyboardWillShowNotification object:nil]; 221 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBoardWillHide:) name:UIKeyboardWillHideNotification object:nil]; 222 | }; 223 | switch (_alertStyle) { 224 | case AlertStyleDefault: 225 | // Default 226 | break; 227 | case AlertStylePlainTextInput: 228 | _textField = [[UITextField alloc] init]; 229 | addKeybordNotification(); 230 | break; 231 | case AlertStyleSecureTextInput: 232 | _textField = [[UITextField alloc] init]; 233 | addKeybordNotification(); 234 | break; 235 | case AlertStyleLoginAndPasswordInput: 236 | _textField = [[UITextField alloc] init]; 237 | _passwordTextField = [[UITextField alloc] init]; 238 | addKeybordNotification(); 239 | break; 240 | default: 241 | break; 242 | } 243 | } 244 | CGRect getScreenBounds() { 245 | CGRect screenBounds = [UIScreen mainScreen].bounds; 246 | if ((NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1) && 247 | UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) { 248 | return CGRectMake(0, 0, screenBounds.size.height, screenBounds.size.width); 249 | } 250 | return screenBounds; 251 | } 252 | /** 253 | * 刷新 254 | */ 255 | - (void)needsDisplay{ 256 | if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1) { 257 | [UIView animateWithDuration:0.3 animations:^{ 258 | self.transform = [[[UIApplication sharedApplication].keyWindow subviews] objectAtIndex:0].transform; 259 | }]; 260 | } 261 | self.frame = [UIScreen mainScreen].bounds; 262 | 263 | CGRect screenBounds = getScreenBounds(); 264 | // 设置背影半透明 265 | self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3]; 266 | if (_alertView) { 267 | [_alertView removeFromSuperview]; 268 | _alertView = nil; 269 | } 270 | // 1.alertView 271 | _alertView = [[UIView alloc] init]; 272 | _alertView.backgroundColor = [UIColor whiteColor]; 273 | [self addSubview:_alertView]; 274 | float width = 280; 275 | if (messageText && messageText.length > 100) { 276 | width = screenBounds.size.width-40; 277 | } 278 | _alertView.frame = CGRectMake(0, 0, width, 200); 279 | _alertView.layer.cornerRadius = 6; 280 | _alertView.layer.masksToBounds = YES; 281 | 282 | // 2.title 283 | _titleLabel = [[UILabel alloc] init]; 284 | [_alertView addSubview:_titleLabel]; 285 | _titleLabel.numberOfLines = 3; 286 | _titleLabel.textAlignment = NSTextAlignmentCenter; 287 | _titleLabel.lineBreakMode = NSLineBreakByTruncatingTail; 288 | _titleLabel.numberOfLines = 3; 289 | _titleLabel.text = [NSString stringWithFormat:@" %@", titleText]; 290 | _titleLabel.font = [UIFont systemFontOfSize:17]; 291 | _titleLabel.textColor = [UIColor colorWithRed:(255.0/255) green:(127.0/255) blue:(70.0/255) alpha:1]; 292 | CGRect rect = [_titleLabel textRectForBounds:CGRectMake(0, 20, _alertView.frame.size.width-40, 100) limitedToNumberOfLines:3]; 293 | rect.origin.x = 20; 294 | _titleLabel.frame = rect; 295 | _titleLabel.center = CGPointMake(CGRectGetWidth(_alertView.frame)/2, CGRectGetHeight(_titleLabel.frame)/2+15); 296 | 297 | // 3.imageView 298 | NSInteger imageTag = 821827; 299 | UIImageView *imageView = (UIImageView *)[self viewWithTag:imageTag]; 300 | if (imageView == NULL) { 301 | imageView = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMinX(_titleLabel.frame), 15, 20, 20)]; 302 | imageView.image = [self getiImage]; 303 | [_alertView addSubview:imageView]; 304 | } 305 | CGFloat height = CGRectGetMaxY(_titleLabel.frame); 306 | 307 | if (messageText) { 308 | // 4.messageLabel 309 | _messageLabel = [[UITextView alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(_titleLabel.frame)+10, _alertView.frame.size.width-20, 35)]; 310 | _messageLabel.backgroundColor = [UIColor clearColor]; 311 | _messageLabel.editable = NO; 312 | _messageLabel.scrollEnabled = NO; 313 | _messageLabel.selectable = NO; 314 | [_messageLabel flashScrollIndicators]; // 闪动滚动条 315 | [_alertView addSubview:_messageLabel]; 316 | CGRect frame = _messageLabel.frame; 317 | NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; 318 | style.lineSpacing = _lineSpacing; 319 | style.paragraphSpacing = _paragraphSpacing; 320 | style.alignment = _contentAlignment; 321 | NSDictionary *dic = @{NSFontAttributeName:_font,NSParagraphStyleAttributeName:style}; 322 | CGFloat broadWith = (_messageLabel.contentInset.left 323 | + _messageLabel.contentInset.right 324 | + _messageLabel.textContainerInset.left 325 | + _messageLabel.textContainerInset.right 326 | + _messageLabel.textContainer.lineFragmentPadding/*左边距*/ 327 | + _messageLabel.textContainer.lineFragmentPadding/*右边距*/); 328 | CGFloat textHeight = screenBounds.size.height>screenBounds.size.width?(screenBounds.size.height-64-49-100-(argsArray.count <= 2?44:argsArray.count*44)-20):(screenBounds.size.height-100-(argsArray.count <= 2?44:argsArray.count*44)); 329 | CGSize size = [messageText boundingRectWithSize:CGSizeMake(_alertView.frame.size.width-20-broadWith, LINE_MAX) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:dic context:nil].size; 330 | CGFloat broadHeight = (_messageLabel.contentInset.top 331 | + _messageLabel.contentInset.bottom 332 | + _messageLabel.textContainerInset.top 333 | + _messageLabel.textContainerInset.bottom); 334 | CGSize adjustedSize = CGSizeMake(frame.size.width, size.height+broadHeight); 335 | frame.size.width = _alertView.frame.size.width-20; 336 | frame.size.height = adjustedSize.height; 337 | if (frame.size.height >= textHeight){ 338 | frame.size.height = textHeight; 339 | _messageLabel.scrollEnabled = YES; // 允许滚动 340 | }else{ 341 | _messageLabel.scrollEnabled = NO; // 不允许滚动 342 | } 343 | _messageLabel.frame = frame; 344 | _messageLabel.contentSize = CGSizeMake(_alertView.frame.size.width-20, size.height); 345 | [_messageLabel setAttributedText:[[NSAttributedString alloc] initWithString:messageText attributes:dic]]; 346 | 347 | height = CGRectGetMaxY(_messageLabel.frame); 348 | } 349 | 350 | switch (_alertStyle) { 351 | case AlertStyleDefault: 352 | // Default 353 | break; 354 | case AlertStylePlainTextInput: 355 | _textField.frame = CGRectMake(20, height+5, _alertView.bounds.size.width-40, 40); 356 | _textField.layer.borderColor = [UIColor colorWithRed:0.5176 green:0.5176 blue:0.5176 alpha:1.0].CGColor; 357 | _textField.layer.borderWidth = 0.3; 358 | _textField.layer.cornerRadius = 2; 359 | _textField.delegate = self; 360 | _textField.backgroundColor = [UIColor clearColor]; 361 | [_alertView addSubview:_textField]; 362 | height = CGRectGetMaxY(_textField.frame); 363 | break; 364 | case AlertStyleSecureTextInput: 365 | _textField.frame = CGRectMake(20, height+5, _alertView.bounds.size.width-40, 40); 366 | _textField.layer.borderColor = [UIColor colorWithRed:0.5176 green:0.5176 blue:0.5176 alpha:1.0].CGColor; 367 | _textField.layer.borderWidth = 0.3; 368 | _textField.layer.cornerRadius = 2; 369 | [_textField setSecureTextEntry:YES]; 370 | _textField.delegate = self; 371 | _textField.backgroundColor = [UIColor clearColor]; 372 | [_alertView addSubview:_textField]; 373 | height = CGRectGetMaxY(_textField.frame); 374 | break; 375 | case AlertStyleLoginAndPasswordInput: 376 | _textField.frame = CGRectMake(20, height+5, _alertView.bounds.size.width-40, 40); 377 | _textField.layer.borderColor = [UIColor colorWithRed:0.5176 green:0.5176 blue:0.5176 alpha:1.0].CGColor; 378 | _textField.layer.borderWidth = 0.3; 379 | _textField.layer.cornerRadius = 2; 380 | _textField.delegate = self; 381 | _textField.backgroundColor = [UIColor clearColor]; 382 | [_alertView addSubview:_textField]; 383 | height = CGRectGetMaxY(_textField.frame); 384 | 385 | _passwordTextField.frame = CGRectMake(20, height-0.3, _alertView.bounds.size.width-40, 40); 386 | _passwordTextField.layer.borderColor = [UIColor colorWithRed:0.5176 green:0.5176 blue:0.5176 alpha:1.0].CGColor; 387 | _passwordTextField.layer.borderWidth = 0.3; 388 | _passwordTextField.layer.cornerRadius = 2; 389 | [_passwordTextField setSecureTextEntry:YES]; 390 | _passwordTextField.delegate = self; 391 | _passwordTextField.backgroundColor = [UIColor clearColor]; 392 | [_alertView addSubview:_passwordTextField]; 393 | height = CGRectGetMaxY(_passwordTextField.frame); 394 | break; 395 | default: 396 | break; 397 | } 398 | 399 | for (UIView *view in _alertView.subviews) { 400 | if ([view isKindOfClass:[UIButton class]]) { 401 | [view removeFromSuperview]; 402 | } 403 | } 404 | if (argsArray.count <= 2) { 405 | //这里循环 将看到所有参数 406 | for (int j = 0; j < [argsArray count]; j++){ 407 | NSString *s = argsArray[j]; 408 | UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 409 | button.backgroundColor = [UIColor clearColor]; 410 | button.frame = CGRectMake((CGRectGetWidth(_alertView.frame)+2)/argsArray.count*j-1, height+10, (CGRectGetWidth(_alertView.frame)+2)/argsArray.count, 44); 411 | button.layer.borderColor = [UIColor colorWithWhite:0 alpha:0.1].CGColor; 412 | button.layer.borderWidth = 0.5; 413 | button.tag = j; 414 | button.titleLabel.font = [UIFont systemFontOfSize:15]; 415 | [button setTitleColor:[UIColor colorWithRed:(57.0/255) green:(170.0/255) blue:(196.0/255) alpha:1] forState:UIControlStateNormal]; 416 | [button setTitleColor:[UIColor colorWithRed:(132.0/255) green:(132.0/255) blue:(132.0/255) alpha:1] forState:UIControlStateHighlighted]; 417 | 418 | [button setTitle:s forState:UIControlStateNormal]; 419 | [_alertView addSubview:button]; 420 | if (hasCancelBtn == YES){ 421 | [button addTarget:self action:@selector(cancalClick:) forControlEvents:UIControlEventTouchUpInside]; 422 | }else{ 423 | [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside]; 424 | } 425 | } 426 | height += 54; 427 | } else { 428 | if (hasCancelBtn == YES){ 429 | [argsArray addObject:argsArray[0]]; 430 | [argsArray removeObjectAtIndex:0]; 431 | } 432 | for (int j = 0; j < [argsArray count]; j++){ 433 | NSString *s = argsArray[j]; 434 | UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 435 | button.backgroundColor = [UIColor clearColor]; 436 | button.frame = CGRectMake(0, height, CGRectGetWidth(_alertView.frame), 44); 437 | button.layer.borderColor = [UIColor colorWithWhite:0 alpha:0.1].CGColor; 438 | button.layer.borderWidth = 0.5; 439 | button.tag = j; 440 | button.titleLabel.font = [UIFont systemFontOfSize:15]; 441 | [button setTitleColor:[UIColor colorWithRed:(57.0/255) green:(170.0/255) blue:(196.0/255) alpha:1] forState:UIControlStateNormal]; 442 | [button setTitleColor:[UIColor colorWithRed:(132.0/255) green:(132.0/255) blue:(132.0/255) alpha:1] forState:UIControlStateHighlighted]; 443 | 444 | [button setTitle:s forState:UIControlStateNormal]; 445 | [_alertView addSubview:button]; 446 | if (hasCancelBtn == YES){ 447 | [button addTarget:self action:@selector(cancalClick:) forControlEvents:UIControlEventTouchUpInside]; 448 | }else{ 449 | [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside]; 450 | } 451 | height = CGRectGetMaxY(button.frame); 452 | } 453 | } 454 | CGRect rect2 = _alertView.frame; 455 | rect2.size.height = height; 456 | _alertView.frame = rect2; 457 | _alertView.center = CGPointMake(screenBounds.size.width/2, screenBounds.size.height/2); 458 | } 459 | 460 | #pragma mark - search 461 | /** 462 | * 显示键盘 463 | * 464 | * @param note 465 | */ 466 | - (void)keyBoardWillShow:(NSNotification *)note{ 467 | 468 | CGRect screenBounds = getScreenBounds(); 469 | CGRect rect = [note.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; 470 | [UIView animateWithDuration:[note.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue] animations:^{ 471 | CGRect viewRect = self.alertView.frame; 472 | viewRect.origin.y = CGRectGetHeight(screenBounds)-rect.size.height-viewRect.size.height; 473 | self.alertView.frame = viewRect; 474 | }completion:^(BOOL finished) { 475 | }]; 476 | } 477 | 478 | /** 479 | * 隐藏键盘 480 | */ 481 | - (void)keyBoardWillHide:(NSNotification *)note{ 482 | [UIView animateWithDuration:[note.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue] animations:^{ 483 | self.alertView.center = self.center; 484 | }]; 485 | } 486 | 487 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { 488 | [_textField resignFirstResponder]; 489 | [_passwordTextField resignFirstResponder]; 490 | } 491 | 492 | /** 493 | * 设置取消的Block copy 494 | * 495 | * @param cancelBlock 取消的Block 496 | */ 497 | - (void)setCancelBlock:(CancelAlertBlock)cancelBlock{ 498 | _cancelBlock = [cancelBlock copy]; 499 | } 500 | 501 | /** 502 | * 设置点击的Block copy 503 | * 504 | * @param clickBlock 点击的Block 505 | */ 506 | - (void)setClickBlock:(ClicksAlertBlock)clickBlock{ 507 | _clickBlock = [clickBlock copy]; 508 | } 509 | 510 | @end 511 | -------------------------------------------------------------------------------- /Alert/Alert/AlertView/s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/Alert/Alert/AlertView/s.png -------------------------------------------------------------------------------- /Alert/Alert/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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Alert/B902C6B8-0C75-43F7-BE1C-B7485F440541.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/Alert/B902C6B8-0C75-43F7-BE1C-B7485F440541.png -------------------------------------------------------------------------------- /Alert/CA246576-E925-4195-B0D6-072E7FC1F3D6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/Alert/CA246576-E925-4195-B0D6-072E7FC1F3D6.jpeg -------------------------------------------------------------------------------- /Alert/Products/Alert.framework/Alert: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/Alert/Products/Alert.framework/Alert -------------------------------------------------------------------------------- /Alert/Products/Alert.framework/Headers/Alert.h: -------------------------------------------------------------------------------- 1 | // 2 | // Alert.h 3 | // test 4 | // 5 | // Created by Whde on 14/12/22. 6 | // Copyright (c) 2014年 whde. All rights reserved. 7 | // 8 | // GitHub:https://github.com/whde/Alert 9 | #import 10 | #define DEFAULT_LINE_SPACING (int)0 11 | #define DEFAULT_PARAGRAPH_SPACING (int)3 12 | 13 | typedef NS_ENUM(NSInteger, AlertStyle) { 14 | AlertStyleDefault = 0, 15 | AlertStyleSecureTextInput, 16 | AlertStylePlainTextInput, 17 | AlertStyleLoginAndPasswordInput 18 | }; 19 | @class Alert; 20 | @protocol AlertDelegate; 21 | 22 | @interface Alert : UIView { 23 | UITextView *_messageLabel; 24 | UILabel *_titleLabel; 25 | } 26 | @property (nonatomic, retain) id object; 27 | // delegate 28 | @property (nonatomic, assign, readonly) iddelegate; 29 | 30 | // alertView 31 | @property (nonatomic, strong, readonly) UIView *alertView; 32 | 33 | // 内容文字大小 34 | @property (nonatomic, strong) UIFont *font; 35 | 36 | // 设置message的对齐方式 37 | @property (nonatomic, assign) NSTextAlignment contentAlignment; 38 | 39 | // Alert TextInput LoginInput 40 | @property (nonatomic, strong) UITextField *textField; 41 | 42 | // Alert PasswordInput 43 | @property (nonatomic, strong) UITextField *passwordTextField; 44 | 45 | @property (nonatomic, assign) CGFloat lineSpacing; // DEFAULT_LINE_SPACING 46 | @property (nonatomic, assign) CGFloat paragraphSpacing; // DEFAULT_PARAGRAPH_SPACING 47 | @property (nonatomic, assign) AlertStyle alertStyle; // DEFAULT_PARAGRAPH_SPACING 48 | 49 | #pragma mark - --block 50 | typedef void (^CancelAlertBlock)(Alert *alertView) ; 51 | typedef void (^ClicksAlertBlock)(Alert *alertView, NSInteger buttonIndex); 52 | @property (nonatomic, copy, readonly) CancelAlertBlock cancelBlock; 53 | @property (nonatomic, copy, readonly) ClicksAlertBlock clickBlock; 54 | - (void)setCancelBlock:(CancelAlertBlock)cancelBlock; 55 | - (void)setClickBlock:(ClicksAlertBlock)clickBlock; 56 | 57 | #pragma mark - --init 58 | /** 59 | * 创建alertView 60 | * 61 | * @param title 提示标题 62 | * @param message 提示详情 63 | * @param delegate 协议对象 64 | * @param cancelButtonTitle 取消按钮名称 65 | * @param otherButtonTitles 其他按钮 66 | * 67 | * @return Alert Alert * 68 | */ 69 | - (instancetype)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id /**/)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...NS_REQUIRES_NIL_TERMINATION; 70 | 71 | /** 72 | * 显示alertView 73 | */ 74 | - (void)show; 75 | @end 76 | 77 | #pragma mark - --delegate 78 | @protocol AlertDelegate 79 | 80 | @optional 81 | /** 82 | * 点击按钮协议 83 | * 84 | * @param alertView Alert * 85 | * @param buttonIndex 0,1,2... 86 | */ 87 | - (void)alertView:(Alert *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex; 88 | 89 | /** 90 | * 取消协议 91 | * 92 | * @param alertView Alert * 93 | */ 94 | - (void)alertViewCancel:(Alert *)alertView; 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /Alert/Products/Alert.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/Alert/Products/Alert.framework/Info.plist -------------------------------------------------------------------------------- /Alert/Products/Alert.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module Alert { 2 | umbrella header "Alert.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Alert/Untitled.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/Alert/Untitled.gif -------------------------------------------------------------------------------- /Alert/未命名.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/Alert/未命名.mov -------------------------------------------------------------------------------- /AlertDemo/AlertDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F8DC169F1CAE152300B950D9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F8DC169E1CAE152300B950D9 /* main.m */; }; 11 | F8DC16A21CAE152300B950D9 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F8DC16A11CAE152300B950D9 /* AppDelegate.m */; }; 12 | F8DC16A51CAE152300B950D9 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F8DC16A41CAE152300B950D9 /* ViewController.m */; }; 13 | F8DC16A81CAE152300B950D9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F8DC16A61CAE152300B950D9 /* Main.storyboard */; }; 14 | F8DC16AA1CAE152300B950D9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F8DC16A91CAE152300B950D9 /* Assets.xcassets */; }; 15 | F8DC16AD1CAE152300B950D9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F8DC16AB1CAE152300B950D9 /* LaunchScreen.storyboard */; }; 16 | F8DC16BE1CAE155500B950D9 /* Alert.m in Sources */ = {isa = PBXBuildFile; fileRef = F8DC16BC1CAE155500B950D9 /* Alert.m */; }; 17 | F8DC16BF1CAE155500B950D9 /* s.png in Resources */ = {isa = PBXBuildFile; fileRef = F8DC16BD1CAE155500B950D9 /* s.png */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | F8DC169A1CAE152300B950D9 /* AlertDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AlertDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | F8DC169E1CAE152300B950D9 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 23 | F8DC16A01CAE152300B950D9 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 24 | F8DC16A11CAE152300B950D9 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 25 | F8DC16A31CAE152300B950D9 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 26 | F8DC16A41CAE152300B950D9 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 27 | F8DC16A71CAE152300B950D9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 28 | F8DC16A91CAE152300B950D9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 29 | F8DC16AC1CAE152300B950D9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 30 | F8DC16AE1CAE152300B950D9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | F8DC16BB1CAE155500B950D9 /* Alert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Alert.h; sourceTree = ""; }; 32 | F8DC16BC1CAE155500B950D9 /* Alert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Alert.m; sourceTree = ""; }; 33 | F8DC16BD1CAE155500B950D9 /* s.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = s.png; sourceTree = ""; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | F8DC16971CAE152300B950D9 /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | /* End PBXFrameworksBuildPhase section */ 45 | 46 | /* Begin PBXGroup section */ 47 | F8DC16911CAE152300B950D9 = { 48 | isa = PBXGroup; 49 | children = ( 50 | F8DC16BA1CAE155500B950D9 /* AlertView */, 51 | F8DC169C1CAE152300B950D9 /* AlertDemo */, 52 | F8DC169B1CAE152300B950D9 /* Products */, 53 | ); 54 | sourceTree = ""; 55 | }; 56 | F8DC169B1CAE152300B950D9 /* Products */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | F8DC169A1CAE152300B950D9 /* AlertDemo.app */, 60 | ); 61 | name = Products; 62 | sourceTree = ""; 63 | }; 64 | F8DC169C1CAE152300B950D9 /* AlertDemo */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | F8DC16A01CAE152300B950D9 /* AppDelegate.h */, 68 | F8DC16A11CAE152300B950D9 /* AppDelegate.m */, 69 | F8DC16A31CAE152300B950D9 /* ViewController.h */, 70 | F8DC16A41CAE152300B950D9 /* ViewController.m */, 71 | F8DC16A61CAE152300B950D9 /* Main.storyboard */, 72 | F8DC16A91CAE152300B950D9 /* Assets.xcassets */, 73 | F8DC16AB1CAE152300B950D9 /* LaunchScreen.storyboard */, 74 | F8DC16AE1CAE152300B950D9 /* Info.plist */, 75 | F8DC169D1CAE152300B950D9 /* Supporting Files */, 76 | ); 77 | path = AlertDemo; 78 | sourceTree = ""; 79 | }; 80 | F8DC169D1CAE152300B950D9 /* Supporting Files */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | F8DC169E1CAE152300B950D9 /* main.m */, 84 | ); 85 | name = "Supporting Files"; 86 | sourceTree = ""; 87 | }; 88 | F8DC16BA1CAE155500B950D9 /* AlertView */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | F8DC16BB1CAE155500B950D9 /* Alert.h */, 92 | F8DC16BC1CAE155500B950D9 /* Alert.m */, 93 | F8DC16BD1CAE155500B950D9 /* s.png */, 94 | ); 95 | name = AlertView; 96 | path = ../Alert/Alert/AlertView; 97 | sourceTree = ""; 98 | }; 99 | /* End PBXGroup section */ 100 | 101 | /* Begin PBXNativeTarget section */ 102 | F8DC16991CAE152300B950D9 /* AlertDemo */ = { 103 | isa = PBXNativeTarget; 104 | buildConfigurationList = F8DC16B11CAE152300B950D9 /* Build configuration list for PBXNativeTarget "AlertDemo" */; 105 | buildPhases = ( 106 | F8DC16961CAE152300B950D9 /* Sources */, 107 | F8DC16971CAE152300B950D9 /* Frameworks */, 108 | F8DC16981CAE152300B950D9 /* Resources */, 109 | ); 110 | buildRules = ( 111 | ); 112 | dependencies = ( 113 | ); 114 | name = AlertDemo; 115 | productName = AlertDemo; 116 | productReference = F8DC169A1CAE152300B950D9 /* AlertDemo.app */; 117 | productType = "com.apple.product-type.application"; 118 | }; 119 | /* End PBXNativeTarget section */ 120 | 121 | /* Begin PBXProject section */ 122 | F8DC16921CAE152300B950D9 /* Project object */ = { 123 | isa = PBXProject; 124 | attributes = { 125 | LastUpgradeCheck = 1010; 126 | ORGANIZATIONNAME = whde; 127 | TargetAttributes = { 128 | F8DC16991CAE152300B950D9 = { 129 | CreatedOnToolsVersion = 7.3; 130 | DevelopmentTeam = LP6RFHXTZE; 131 | ProvisioningStyle = Automatic; 132 | }; 133 | }; 134 | }; 135 | buildConfigurationList = F8DC16951CAE152300B950D9 /* Build configuration list for PBXProject "AlertDemo" */; 136 | compatibilityVersion = "Xcode 3.2"; 137 | developmentRegion = English; 138 | hasScannedForEncodings = 0; 139 | knownRegions = ( 140 | en, 141 | Base, 142 | ); 143 | mainGroup = F8DC16911CAE152300B950D9; 144 | productRefGroup = F8DC169B1CAE152300B950D9 /* Products */; 145 | projectDirPath = ""; 146 | projectRoot = ""; 147 | targets = ( 148 | F8DC16991CAE152300B950D9 /* AlertDemo */, 149 | ); 150 | }; 151 | /* End PBXProject section */ 152 | 153 | /* Begin PBXResourcesBuildPhase section */ 154 | F8DC16981CAE152300B950D9 /* Resources */ = { 155 | isa = PBXResourcesBuildPhase; 156 | buildActionMask = 2147483647; 157 | files = ( 158 | F8DC16AD1CAE152300B950D9 /* LaunchScreen.storyboard in Resources */, 159 | F8DC16AA1CAE152300B950D9 /* Assets.xcassets in Resources */, 160 | F8DC16A81CAE152300B950D9 /* Main.storyboard in Resources */, 161 | F8DC16BF1CAE155500B950D9 /* s.png in Resources */, 162 | ); 163 | runOnlyForDeploymentPostprocessing = 0; 164 | }; 165 | /* End PBXResourcesBuildPhase section */ 166 | 167 | /* Begin PBXSourcesBuildPhase section */ 168 | F8DC16961CAE152300B950D9 /* Sources */ = { 169 | isa = PBXSourcesBuildPhase; 170 | buildActionMask = 2147483647; 171 | files = ( 172 | F8DC16A51CAE152300B950D9 /* ViewController.m in Sources */, 173 | F8DC16A21CAE152300B950D9 /* AppDelegate.m in Sources */, 174 | F8DC16BE1CAE155500B950D9 /* Alert.m in Sources */, 175 | F8DC169F1CAE152300B950D9 /* main.m in Sources */, 176 | ); 177 | runOnlyForDeploymentPostprocessing = 0; 178 | }; 179 | /* End PBXSourcesBuildPhase section */ 180 | 181 | /* Begin PBXVariantGroup section */ 182 | F8DC16A61CAE152300B950D9 /* Main.storyboard */ = { 183 | isa = PBXVariantGroup; 184 | children = ( 185 | F8DC16A71CAE152300B950D9 /* Base */, 186 | ); 187 | name = Main.storyboard; 188 | sourceTree = ""; 189 | }; 190 | F8DC16AB1CAE152300B950D9 /* LaunchScreen.storyboard */ = { 191 | isa = PBXVariantGroup; 192 | children = ( 193 | F8DC16AC1CAE152300B950D9 /* Base */, 194 | ); 195 | name = LaunchScreen.storyboard; 196 | sourceTree = ""; 197 | }; 198 | /* End PBXVariantGroup section */ 199 | 200 | /* Begin XCBuildConfiguration section */ 201 | F8DC16AF1CAE152300B950D9 /* Debug */ = { 202 | isa = XCBuildConfiguration; 203 | buildSettings = { 204 | ALWAYS_SEARCH_USER_PATHS = NO; 205 | CLANG_ANALYZER_NONNULL = YES; 206 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 207 | CLANG_CXX_LIBRARY = "libc++"; 208 | CLANG_ENABLE_MODULES = YES; 209 | CLANG_ENABLE_OBJC_ARC = YES; 210 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 211 | CLANG_WARN_BOOL_CONVERSION = YES; 212 | CLANG_WARN_COMMA = YES; 213 | CLANG_WARN_CONSTANT_CONVERSION = YES; 214 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 215 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 216 | CLANG_WARN_EMPTY_BODY = YES; 217 | CLANG_WARN_ENUM_CONVERSION = YES; 218 | CLANG_WARN_INFINITE_RECURSION = YES; 219 | CLANG_WARN_INT_CONVERSION = YES; 220 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 221 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 222 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 223 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 224 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 225 | CLANG_WARN_STRICT_PROTOTYPES = YES; 226 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 227 | CLANG_WARN_UNREACHABLE_CODE = YES; 228 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 229 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 230 | COPY_PHASE_STRIP = NO; 231 | DEBUG_INFORMATION_FORMAT = dwarf; 232 | ENABLE_STRICT_OBJC_MSGSEND = YES; 233 | ENABLE_TESTABILITY = YES; 234 | GCC_C_LANGUAGE_STANDARD = gnu99; 235 | GCC_DYNAMIC_NO_PIC = NO; 236 | GCC_NO_COMMON_BLOCKS = YES; 237 | GCC_OPTIMIZATION_LEVEL = 0; 238 | GCC_PREPROCESSOR_DEFINITIONS = ( 239 | "DEBUG=1", 240 | "$(inherited)", 241 | ); 242 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 243 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 244 | GCC_WARN_UNDECLARED_SELECTOR = YES; 245 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 246 | GCC_WARN_UNUSED_FUNCTION = YES; 247 | GCC_WARN_UNUSED_VARIABLE = YES; 248 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 249 | MTL_ENABLE_DEBUG_INFO = YES; 250 | ONLY_ACTIVE_ARCH = YES; 251 | SDKROOT = iphoneos; 252 | TARGETED_DEVICE_FAMILY = "1,2"; 253 | }; 254 | name = Debug; 255 | }; 256 | F8DC16B01CAE152300B950D9 /* Release */ = { 257 | isa = XCBuildConfiguration; 258 | buildSettings = { 259 | ALWAYS_SEARCH_USER_PATHS = NO; 260 | CLANG_ANALYZER_NONNULL = YES; 261 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 262 | CLANG_CXX_LIBRARY = "libc++"; 263 | CLANG_ENABLE_MODULES = YES; 264 | CLANG_ENABLE_OBJC_ARC = YES; 265 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 266 | CLANG_WARN_BOOL_CONVERSION = YES; 267 | CLANG_WARN_COMMA = YES; 268 | CLANG_WARN_CONSTANT_CONVERSION = YES; 269 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 270 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 271 | CLANG_WARN_EMPTY_BODY = YES; 272 | CLANG_WARN_ENUM_CONVERSION = YES; 273 | CLANG_WARN_INFINITE_RECURSION = YES; 274 | CLANG_WARN_INT_CONVERSION = YES; 275 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 276 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 277 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 278 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 279 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 280 | CLANG_WARN_STRICT_PROTOTYPES = YES; 281 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 282 | CLANG_WARN_UNREACHABLE_CODE = YES; 283 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 284 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 285 | COPY_PHASE_STRIP = NO; 286 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 287 | ENABLE_NS_ASSERTIONS = NO; 288 | ENABLE_STRICT_OBJC_MSGSEND = YES; 289 | GCC_C_LANGUAGE_STANDARD = gnu99; 290 | GCC_NO_COMMON_BLOCKS = YES; 291 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 292 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 293 | GCC_WARN_UNDECLARED_SELECTOR = YES; 294 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 295 | GCC_WARN_UNUSED_FUNCTION = YES; 296 | GCC_WARN_UNUSED_VARIABLE = YES; 297 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 298 | MTL_ENABLE_DEBUG_INFO = NO; 299 | SDKROOT = iphoneos; 300 | TARGETED_DEVICE_FAMILY = "1,2"; 301 | VALIDATE_PRODUCT = YES; 302 | }; 303 | name = Release; 304 | }; 305 | F8DC16B21CAE152300B950D9 /* Debug */ = { 306 | isa = XCBuildConfiguration; 307 | buildSettings = { 308 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 309 | CODE_SIGN_IDENTITY = "iPhone Developer"; 310 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 311 | CODE_SIGN_STYLE = Automatic; 312 | DEVELOPMENT_TEAM = LP6RFHXTZE; 313 | INFOPLIST_FILE = AlertDemo/Info.plist; 314 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 315 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 316 | PRODUCT_BUNDLE_IDENTIFIER = com.Whde.AlertDemo; 317 | PRODUCT_NAME = "$(TARGET_NAME)"; 318 | PROVISIONING_PROFILE = ""; 319 | PROVISIONING_PROFILE_SPECIFIER = ""; 320 | }; 321 | name = Debug; 322 | }; 323 | F8DC16B31CAE152300B950D9 /* Release */ = { 324 | isa = XCBuildConfiguration; 325 | buildSettings = { 326 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 327 | CODE_SIGN_IDENTITY = "iPhone Developer"; 328 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 329 | CODE_SIGN_STYLE = Automatic; 330 | DEVELOPMENT_TEAM = LP6RFHXTZE; 331 | INFOPLIST_FILE = AlertDemo/Info.plist; 332 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 333 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 334 | PRODUCT_BUNDLE_IDENTIFIER = com.Whde.AlertDemo; 335 | PRODUCT_NAME = "$(TARGET_NAME)"; 336 | PROVISIONING_PROFILE = ""; 337 | PROVISIONING_PROFILE_SPECIFIER = ""; 338 | }; 339 | name = Release; 340 | }; 341 | /* End XCBuildConfiguration section */ 342 | 343 | /* Begin XCConfigurationList section */ 344 | F8DC16951CAE152300B950D9 /* Build configuration list for PBXProject "AlertDemo" */ = { 345 | isa = XCConfigurationList; 346 | buildConfigurations = ( 347 | F8DC16AF1CAE152300B950D9 /* Debug */, 348 | F8DC16B01CAE152300B950D9 /* Release */, 349 | ); 350 | defaultConfigurationIsVisible = 0; 351 | defaultConfigurationName = Release; 352 | }; 353 | F8DC16B11CAE152300B950D9 /* Build configuration list for PBXNativeTarget "AlertDemo" */ = { 354 | isa = XCConfigurationList; 355 | buildConfigurations = ( 356 | F8DC16B21CAE152300B950D9 /* Debug */, 357 | F8DC16B31CAE152300B950D9 /* Release */, 358 | ); 359 | defaultConfigurationIsVisible = 0; 360 | defaultConfigurationName = Release; 361 | }; 362 | /* End XCConfigurationList section */ 363 | }; 364 | rootObject = F8DC16921CAE152300B950D9 /* Project object */; 365 | } 366 | -------------------------------------------------------------------------------- /AlertDemo/AlertDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AlertDemo/AlertDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AlertDemo/AlertDemo.xcodeproj/project.xcworkspace/xcuserdata/OS.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/AlertDemo.xcodeproj/project.xcworkspace/xcuserdata/OS.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AlertDemo/AlertDemo.xcodeproj/project.xcworkspace/xcuserdata/whde.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/AlertDemo.xcodeproj/project.xcworkspace/xcuserdata/whde.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AlertDemo/AlertDemo.xcodeproj/xcuserdata/OS.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AlertDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | AlertDemo.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /AlertDemo/AlertDemo.xcodeproj/xcuserdata/whde.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /AlertDemo/AlertDemo.xcodeproj/xcuserdata/whde.xcuserdatad/xcschemes/AlertDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 69 | 70 | 71 | 72 | 78 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /AlertDemo/AlertDemo.xcodeproj/xcuserdata/whde.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AlertDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | F8DC16991CAE152300B950D9 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AlertDemo 4 | // 5 | // Created by whde on 16/4/1. 6 | // Copyright © 2016年 whde. 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 | -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // AlertDemo 4 | // 5 | // Created by whde on 16/4/1. 6 | // Copyright © 2016年 whde. 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 | -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "size" : "29x29", 15 | "idiom" : "iphone", 16 | "filename" : "Icon-29.0@2x.png", 17 | "scale" : "2x" 18 | }, 19 | { 20 | "size" : "29x29", 21 | "idiom" : "iphone", 22 | "filename" : "Icon-29.0@3x.png", 23 | "scale" : "3x" 24 | }, 25 | { 26 | "size" : "40x40", 27 | "idiom" : "iphone", 28 | "filename" : "Icon-40.0@2x.png", 29 | "scale" : "2x" 30 | }, 31 | { 32 | "size" : "40x40", 33 | "idiom" : "iphone", 34 | "filename" : "Icon-40.0@3x.png", 35 | "scale" : "3x" 36 | }, 37 | { 38 | "size" : "60x60", 39 | "idiom" : "iphone", 40 | "filename" : "Icon-60.0@2x.png", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "size" : "60x60", 45 | "idiom" : "iphone", 46 | "filename" : "Icon-60.0@3x.png", 47 | "scale" : "3x" 48 | }, 49 | { 50 | "idiom" : "ipad", 51 | "size" : "20x20", 52 | "scale" : "1x" 53 | }, 54 | { 55 | "idiom" : "ipad", 56 | "size" : "20x20", 57 | "scale" : "2x" 58 | }, 59 | { 60 | "size" : "29x29", 61 | "idiom" : "ipad", 62 | "filename" : "Icon-29.0@1x.png", 63 | "scale" : "1x" 64 | }, 65 | { 66 | "size" : "29x29", 67 | "idiom" : "ipad", 68 | "filename" : "Icon-29.0@2x.png", 69 | "scale" : "2x" 70 | }, 71 | { 72 | "size" : "40x40", 73 | "idiom" : "ipad", 74 | "filename" : "Icon-40.0@1x.png", 75 | "scale" : "1x" 76 | }, 77 | { 78 | "size" : "40x40", 79 | "idiom" : "ipad", 80 | "filename" : "Icon-40.0@2x.png", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "size" : "76x76", 85 | "idiom" : "ipad", 86 | "filename" : "Icon-76.0@1x.png", 87 | "scale" : "1x" 88 | }, 89 | { 90 | "size" : "76x76", 91 | "idiom" : "ipad", 92 | "filename" : "Icon-76.0@2x.png", 93 | "scale" : "2x" 94 | }, 95 | { 96 | "size" : "83.5x83.5", 97 | "idiom" : "ipad", 98 | "filename" : "Icon-83.5@2x.png", 99 | "scale" : "2x" 100 | }, 101 | { 102 | "idiom" : "ios-marketing", 103 | "size" : "1024x1024", 104 | "scale" : "1x" 105 | } 106 | ], 107 | "info" : { 108 | "version" : 1, 109 | "author" : "xcode" 110 | } 111 | } -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-29.0@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-29.0@1x.png -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-29.0@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-29.0@2x.png -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-29.0@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-29.0@3x.png -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-40.0@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-40.0@1x.png -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-40.0@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-40.0@2x.png -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-40.0@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-40.0@3x.png -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-60.0@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-60.0@2x.png -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-60.0@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-60.0@3x.png -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-76.0@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-76.0@1x.png -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-76.0@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-76.0@2x.png -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/AlertDemo/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/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 | -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/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 | 33 | 42 | 51 | 60 | 69 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/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 | UIInterfaceOrientationPortraitUpsideDown 39 | 40 | UISupportedInterfaceOrientations~ipad 41 | 42 | UIInterfaceOrientationPortrait 43 | UIInterfaceOrientationPortraitUpsideDown 44 | UIInterfaceOrientationLandscapeLeft 45 | UIInterfaceOrientationLandscapeRight 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // AlertDemo 4 | // 5 | // Created by whde on 16/4/1. 6 | // Copyright © 2016年 whde. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // AlertDemo 4 | // 5 | // Created by whde on 16/4/1. 6 | // Copyright © 2016年 whde. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "Alert.h" 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | - (IBAction)twoBtn:(id)sender { 22 | Alert *alert = [[Alert alloc] initWithTitle:@"央行调查:过半居民认为目前房价过高" message:@"  面对回暖的房地产市场,央行昨日发布的2016年第一季度城镇储户问卷调查报告显示,50.7%的居民认为目前房价“高,难以接受”,较上季下降1.3个百分点,45.7%的居民认为目前房价“可以接受”,3.6%的居民认为“令人满意”。\n\n  对于二季度房价,17.6%的居民预期“上涨”,52.1%的居民预期“基本不变”,16.1%的居民预期“下降”,14.2%的居民“看不准”。未来3个月内准备出手购买住房的居民占比为13.6%,较上季回落1.1个百分点。\n\n  对于当期物价,52.7%的居民认为物价“高,难以接受”,较上季提高1.7 个百分点。对未来物价预期,24.8%的居民预期下季物价将“上升”,51.6%的居民预期“基本不变”,11.9%的居民预期“下降”,11.8%的居民“看不准”。\n\n  收入方面,79.6%的居民认为当期收入“增加”或“基本不变”,较上季提高1.2个百分点。但未来收入信心指数为48.4%,较上季下降0.7个百分点。就业方面,11.4%的居民认为一季度“形势较好,就业容易”,43.5%的居民认为“一般”,45.1%的居民认为“形势严峻,就业难”或“看不准”。未来就业预期指数为44.8%,较上季下降0.5 个百分点。\n\n" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"好", nil]; 23 | alert.contentAlignment = NSTextAlignmentLeft; 24 | [alert show]; 25 | } 26 | - (IBAction)threeBtn:(id)sender { 27 | Alert *alert = [[Alert alloc] initWithTitle:@"央行调查:过半居民认为目前房价过高" message:@"  面对回暖的房地产市场,央行昨日发布的2016年第一季度城镇储户问卷调查报告显示,50.7%的居民认为目前房价“高,难以接受”,较上季下降1.3个百分点,45.7%的居民认为目前房价“可以接受”,3.6%的居民认为“令人满意”。\n\n  对于二季度房价,17.6%的居民预期“上涨”,52.1%的居民预期“基本不变”,16.1%的居民预期“下降”,14.2%的居民“看不准”。未来3个月内准备出手购买住房的居民占比为13.6%,较上季回落1.1个百分点。\n\n  对于当期物价,52.7%的居民认为物价“高,难以接受”,较上季提高1.7 个百分点。对未来物价预期,24.8%的居民预期下季物价将“上升”,51.6%的居民预期“基本不变”,11.9%的居民预期“下降”,11.8%的居民“看不准”。\n\n  收入方面,79.6%的居民认为当期收入“增加”或“基本不变”,较上季提高1.2个百分点。但未来收入信心指数为48.4%,较上季下降0.7个百分点。就业方面,11.4%的居民认为一季度“形势较好,就业容易”,43.5%的居民认为“一般”,45.1%的居民认为“形势严峻,就业难”或“看不准”。未来就业预期指数为44.8%,较上季下降0.5 个百分点。\n\n" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"好", @"去", nil]; 28 | alert.contentAlignment = NSTextAlignmentLeft; 29 | [alert show]; 30 | } 31 | - (IBAction)shortMessage:(id)sender { 32 | Alert *alert = [[Alert alloc] initWithTitle:@"央行调查:过半居民认为目前房价过高" message:@"  面对回暖的房地产市场,央行昨日发布的2016年第一季度城镇储户问卷调查报告显示" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"好", nil]; 33 | alert.contentAlignment = NSTextAlignmentCenter; 34 | [alert show]; 35 | } 36 | - (IBAction)longMesage:(id)sender { 37 | Alert *alert = [[Alert alloc] initWithTitle:@"央行调查:过半居民认为目前房价过高" message:@"  面对回暖的房地产市场,央行昨日发布的2016年第一季度城镇储户问卷调查报告显示,50.7%的居民认为目前房价“高,难以接受”,较上季下降1.3个百分点,45.7%的居民认为目前房价“可以接受”,3.6%的居民认为“令人满意”。\n\n  对于二季度房价,17.6%的居民预期“上涨”,52.1%的居民预期“基本不变”,16.1%的居民预期“下降”,14.2%的居民“看不准”。未来3个月内准备出手购买住房的居民占比为13.6%,较上季回落1.1个百分点。\n\n  对于当期物价,52.7%的居民认为物价“高,难以接受”,较上季提高1.7 个百分点。对未来物价预期,24.8%的居民预期下季物价将“上升”,51.6%的居民预期“基本不变”,11.9%的居民预期“下降”,11.8%的居民“看不准”。\n\n  收入方面,79.6%的居民认为当期收入“增加”或“基本不变”,较上季提高1.2个百分点。但未来收入信心指数为48.4%,较上季下降0.7个百分点。就业方面,11.4%的居民认为一季度“形势较好,就业容易”,43.5%的居民认为“一般”,45.1%的居民认为“形势严峻,就业难”或“看不准”。未来就业预期指数为44.8%,较上季下降0.5 个百分点。\n\n" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"好", nil]; 38 | alert.contentAlignment = NSTextAlignmentLeft; 39 | [alert show]; 40 | } 41 | - (IBAction)oneTextField:(id)sender { 42 | Alert *alert = [[Alert alloc] initWithTitle:@"央行调查:过半居民认为目前房价过高" message:@"  面对回暖的房地产市场,央行昨日发布的2016年第一季度城镇储户问卷调查报告显示" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"好", nil]; 43 | [alert setAlertStyle:AlertStyleSecureTextInput]; 44 | alert.contentAlignment = NSTextAlignmentCenter; 45 | [alert show]; 46 | } 47 | - (IBAction)userPasswordTextField:(id)sender { 48 | Alert *alert = [[Alert alloc] initWithTitle:@"央行调查:过半居民认为目前房价过高" message:@"  面对回暖的房地产市场,央行昨日发布的2016年第一季度城镇储户问卷调查报告显示" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"好", nil]; 49 | [alert setAlertStyle:AlertStyleLoginAndPasswordInput]; 50 | alert.contentAlignment = NSTextAlignmentCenter; 51 | [alert show]; 52 | } 53 | 54 | - (void)didReceiveMemoryWarning { 55 | [super didReceiveMemoryWarning]; 56 | // Dispose of any resources that can be recreated. 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /AlertDemo/AlertDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AlertDemo 4 | // 5 | // Created by whde on 16/4/1. 6 | // Copyright © 2016年 whde. 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 | -------------------------------------------------------------------------------- /AlertDemo/ScreenShot_20160401_111507.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/ScreenShot_20160401_111507.png -------------------------------------------------------------------------------- /AlertDemo/ScreenShot_20160401_111540.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/ScreenShot_20160401_111540.png -------------------------------------------------------------------------------- /AlertDemo/ScreenShot_20160401_111552.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/ScreenShot_20160401_111552.png -------------------------------------------------------------------------------- /AlertDemo/ScreenShot_20160401_111558.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/ScreenShot_20160401_111558.png -------------------------------------------------------------------------------- /AlertDemo/ScreenShot_20160401_111606.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/ScreenShot_20160401_111606.png -------------------------------------------------------------------------------- /AlertDemo/ScreenShot_20160401_111611.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/ScreenShot_20160401_111611.png -------------------------------------------------------------------------------- /AlertDemo/ScreenShot_20160401_111619.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/ScreenShot_20160401_111619.png -------------------------------------------------------------------------------- /AlertDemo/ScreenShot_20160401_111624.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/ScreenShot_20160401_111624.png -------------------------------------------------------------------------------- /AlertDemo/ScreenShot_20160401_111645.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/ScreenShot_20160401_111645.png -------------------------------------------------------------------------------- /AlertDemo/ScreenShot_20160401_111651.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/ScreenShot_20160401_111651.png -------------------------------------------------------------------------------- /AlertDemo/ScreenShot_20160401_111707.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/ScreenShot_20160401_111707.png -------------------------------------------------------------------------------- /AlertDemo/ScreenShot_20160401_111712.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/ScreenShot_20160401_111712.png -------------------------------------------------------------------------------- /AlertDemo/ScreenShot_20160401_111719.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/ScreenShot_20160401_111719.png -------------------------------------------------------------------------------- /AlertDemo/ScreenShot_20160401_111726.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whde/Alert/22d46c5b977e6b064f29c1a03c7d53cbef6bfbab/AlertDemo/ScreenShot_20160401_111726.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011–2016 Whde (http://github/whde) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Alert 2 | 消息提醒视图,在Xcode7 ,iOS9.0的SDK中,已经明确提示不再推荐使用UIAlertView,而只能使用UIAlertController; 3 | 而系统的样式不能够满足大多UI的需求,因此自定义一个类似UIAlertView; 4 |

5 | 6 | 7 |

8 | 9 | # 使用: 10 | ```objective-c 11 | pod 'Alert', '~> 1.0.4' 12 | ``` 13 | - 5.导入头文件 14 | ```objective-c 15 | #import "Alert.h" 16 | ``` 17 | 18 | - 6.使用: 19 | 20 | ```objective-c 21 | Alert *alert = [[Alert alloc] initWithTitle:CLocalizedString(@"输入口令") message:nil 22 | delegate:nil 23 | cancelButtonTitle:CLocalizedString(@"取消") 24 | otherButtonTitles:CLocalizedString(@"进入"), nil]; 25 | alert.alertStyle = AlertStylePlainTextInput; 26 | __block Alert*alertV = alert; 27 | [alert setClickBlock:^(Alert *alertView, NSInteger buttonIndex) { 28 | if (buttonIndex == 1) { 29 | NSLog(@"%@", alertV.textField.text); 30 | } 31 | }]; 32 | [alert setCancelBlock:^(Alert *alertView) { 33 | // 取消 34 | }]; 35 | [alert show]; 36 | ``` 37 | 38 |

39 | 40 | 41 |

42 | 43 |

44 | 45 | 46 |

47 | 48 |

49 | 50 | 51 |

52 | 53 |

54 | 55 |

56 | 57 |

58 | 59 |

60 | 61 |

62 | 63 |

64 | 65 |

66 | 67 |

68 | --------------------------------------------------------------------------------