├── .gitattributes ├── NKAlertView ├── NKAlertView.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── niekuan.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── niekuan.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── NKAlertView │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── BottomAlertContentView.h │ ├── BottomAlertContentView.m │ ├── CenterAlertContentView.h │ ├── CenterAlertContentView.m │ ├── Info.plist │ ├── NKAlertView │ │ ├── NKAlertView.h │ │ └── NKAlertView.m │ ├── ViewController.h │ ├── ViewController.m │ ├── main.m │ └── shop_invite_icon.png ├── NKAlertViewTests │ ├── Info.plist │ └── NKAlertViewTests.m └── NKAlertViewUITests │ ├── Info.plist │ └── NKAlertViewUITests.m └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1B10F26C22429704002141E5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B10F26B22429704002141E5 /* AppDelegate.m */; }; 11 | 1B10F26F22429704002141E5 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B10F26E22429704002141E5 /* ViewController.m */; }; 12 | 1B10F27222429704002141E5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1B10F27022429704002141E5 /* Main.storyboard */; }; 13 | 1B10F27422429706002141E5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1B10F27322429706002141E5 /* Assets.xcassets */; }; 14 | 1B10F27722429706002141E5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1B10F27522429706002141E5 /* LaunchScreen.storyboard */; }; 15 | 1B10F27A22429706002141E5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B10F27922429706002141E5 /* main.m */; }; 16 | 1B10F28422429706002141E5 /* NKAlertViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B10F28322429706002141E5 /* NKAlertViewTests.m */; }; 17 | 1B10F28F22429706002141E5 /* NKAlertViewUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B10F28E22429706002141E5 /* NKAlertViewUITests.m */; }; 18 | 1B10F29F22429775002141E5 /* NKAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B10F29D22429775002141E5 /* NKAlertView.m */; }; 19 | 1B10F2A222429931002141E5 /* CenterAlertContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B10F2A122429931002141E5 /* CenterAlertContentView.m */; }; 20 | 1B10F2A522429947002141E5 /* BottomAlertContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B10F2A422429947002141E5 /* BottomAlertContentView.m */; }; 21 | 1B10F30922433E97002141E5 /* shop_invite_icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 1B10F30822433E97002141E5 /* shop_invite_icon.png */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXContainerItemProxy section */ 25 | 1B10F28022429706002141E5 /* PBXContainerItemProxy */ = { 26 | isa = PBXContainerItemProxy; 27 | containerPortal = 1B10F25F22429704002141E5 /* Project object */; 28 | proxyType = 1; 29 | remoteGlobalIDString = 1B10F26622429704002141E5; 30 | remoteInfo = NKAlertView; 31 | }; 32 | 1B10F28B22429706002141E5 /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = 1B10F25F22429704002141E5 /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = 1B10F26622429704002141E5; 37 | remoteInfo = NKAlertView; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 1B10F26722429704002141E5 /* NKAlertView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NKAlertView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 1B10F26A22429704002141E5 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 44 | 1B10F26B22429704002141E5 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 45 | 1B10F26D22429704002141E5 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 46 | 1B10F26E22429704002141E5 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 47 | 1B10F27122429704002141E5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 48 | 1B10F27322429706002141E5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 49 | 1B10F27622429706002141E5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 50 | 1B10F27822429706002141E5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 1B10F27922429706002141E5 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 1B10F27F22429706002141E5 /* NKAlertViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NKAlertViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 1B10F28322429706002141E5 /* NKAlertViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NKAlertViewTests.m; sourceTree = ""; }; 54 | 1B10F28522429706002141E5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | 1B10F28A22429706002141E5 /* NKAlertViewUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NKAlertViewUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 1B10F28E22429706002141E5 /* NKAlertViewUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NKAlertViewUITests.m; sourceTree = ""; }; 57 | 1B10F29022429706002141E5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | 1B10F29D22429775002141E5 /* NKAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NKAlertView.m; sourceTree = ""; }; 59 | 1B10F29E22429775002141E5 /* NKAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NKAlertView.h; sourceTree = ""; }; 60 | 1B10F2A022429931002141E5 /* CenterAlertContentView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CenterAlertContentView.h; sourceTree = ""; }; 61 | 1B10F2A122429931002141E5 /* CenterAlertContentView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CenterAlertContentView.m; sourceTree = ""; }; 62 | 1B10F2A322429947002141E5 /* BottomAlertContentView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BottomAlertContentView.h; sourceTree = ""; }; 63 | 1B10F2A422429947002141E5 /* BottomAlertContentView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BottomAlertContentView.m; sourceTree = ""; }; 64 | 1B10F30822433E97002141E5 /* shop_invite_icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = shop_invite_icon.png; sourceTree = ""; }; 65 | /* End PBXFileReference section */ 66 | 67 | /* Begin PBXFrameworksBuildPhase section */ 68 | 1B10F26422429704002141E5 /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | 1B10F27C22429706002141E5 /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | 1B10F28722429706002141E5 /* Frameworks */ = { 83 | isa = PBXFrameworksBuildPhase; 84 | buildActionMask = 2147483647; 85 | files = ( 86 | ); 87 | runOnlyForDeploymentPostprocessing = 0; 88 | }; 89 | /* End PBXFrameworksBuildPhase section */ 90 | 91 | /* Begin PBXGroup section */ 92 | 1B10F25E22429704002141E5 = { 93 | isa = PBXGroup; 94 | children = ( 95 | 1B10F26922429704002141E5 /* NKAlertView */, 96 | 1B10F28222429706002141E5 /* NKAlertViewTests */, 97 | 1B10F28D22429706002141E5 /* NKAlertViewUITests */, 98 | 1B10F26822429704002141E5 /* Products */, 99 | ); 100 | sourceTree = ""; 101 | }; 102 | 1B10F26822429704002141E5 /* Products */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 1B10F26722429704002141E5 /* NKAlertView.app */, 106 | 1B10F27F22429706002141E5 /* NKAlertViewTests.xctest */, 107 | 1B10F28A22429706002141E5 /* NKAlertViewUITests.xctest */, 108 | ); 109 | name = Products; 110 | sourceTree = ""; 111 | }; 112 | 1B10F26922429704002141E5 /* NKAlertView */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 1B10F29C22429732002141E5 /* NKAlertView */, 116 | 1B10F26A22429704002141E5 /* AppDelegate.h */, 117 | 1B10F26B22429704002141E5 /* AppDelegate.m */, 118 | 1B10F26D22429704002141E5 /* ViewController.h */, 119 | 1B10F26E22429704002141E5 /* ViewController.m */, 120 | 1B10F2A022429931002141E5 /* CenterAlertContentView.h */, 121 | 1B10F2A122429931002141E5 /* CenterAlertContentView.m */, 122 | 1B10F2A322429947002141E5 /* BottomAlertContentView.h */, 123 | 1B10F2A422429947002141E5 /* BottomAlertContentView.m */, 124 | 1B10F30822433E97002141E5 /* shop_invite_icon.png */, 125 | 1B10F27022429704002141E5 /* Main.storyboard */, 126 | 1B10F27322429706002141E5 /* Assets.xcassets */, 127 | 1B10F27522429706002141E5 /* LaunchScreen.storyboard */, 128 | 1B10F27822429706002141E5 /* Info.plist */, 129 | 1B10F27922429706002141E5 /* main.m */, 130 | ); 131 | path = NKAlertView; 132 | sourceTree = ""; 133 | }; 134 | 1B10F28222429706002141E5 /* NKAlertViewTests */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 1B10F28322429706002141E5 /* NKAlertViewTests.m */, 138 | 1B10F28522429706002141E5 /* Info.plist */, 139 | ); 140 | path = NKAlertViewTests; 141 | sourceTree = ""; 142 | }; 143 | 1B10F28D22429706002141E5 /* NKAlertViewUITests */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 1B10F28E22429706002141E5 /* NKAlertViewUITests.m */, 147 | 1B10F29022429706002141E5 /* Info.plist */, 148 | ); 149 | path = NKAlertViewUITests; 150 | sourceTree = ""; 151 | }; 152 | 1B10F29C22429732002141E5 /* NKAlertView */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 1B10F29E22429775002141E5 /* NKAlertView.h */, 156 | 1B10F29D22429775002141E5 /* NKAlertView.m */, 157 | ); 158 | path = NKAlertView; 159 | sourceTree = ""; 160 | }; 161 | /* End PBXGroup section */ 162 | 163 | /* Begin PBXNativeTarget section */ 164 | 1B10F26622429704002141E5 /* NKAlertView */ = { 165 | isa = PBXNativeTarget; 166 | buildConfigurationList = 1B10F29322429706002141E5 /* Build configuration list for PBXNativeTarget "NKAlertView" */; 167 | buildPhases = ( 168 | 1B10F26322429704002141E5 /* Sources */, 169 | 1B10F26422429704002141E5 /* Frameworks */, 170 | 1B10F26522429704002141E5 /* Resources */, 171 | ); 172 | buildRules = ( 173 | ); 174 | dependencies = ( 175 | ); 176 | name = NKAlertView; 177 | productName = NKAlertView; 178 | productReference = 1B10F26722429704002141E5 /* NKAlertView.app */; 179 | productType = "com.apple.product-type.application"; 180 | }; 181 | 1B10F27E22429706002141E5 /* NKAlertViewTests */ = { 182 | isa = PBXNativeTarget; 183 | buildConfigurationList = 1B10F29622429706002141E5 /* Build configuration list for PBXNativeTarget "NKAlertViewTests" */; 184 | buildPhases = ( 185 | 1B10F27B22429706002141E5 /* Sources */, 186 | 1B10F27C22429706002141E5 /* Frameworks */, 187 | 1B10F27D22429706002141E5 /* Resources */, 188 | ); 189 | buildRules = ( 190 | ); 191 | dependencies = ( 192 | 1B10F28122429706002141E5 /* PBXTargetDependency */, 193 | ); 194 | name = NKAlertViewTests; 195 | productName = NKAlertViewTests; 196 | productReference = 1B10F27F22429706002141E5 /* NKAlertViewTests.xctest */; 197 | productType = "com.apple.product-type.bundle.unit-test"; 198 | }; 199 | 1B10F28922429706002141E5 /* NKAlertViewUITests */ = { 200 | isa = PBXNativeTarget; 201 | buildConfigurationList = 1B10F29922429706002141E5 /* Build configuration list for PBXNativeTarget "NKAlertViewUITests" */; 202 | buildPhases = ( 203 | 1B10F28622429706002141E5 /* Sources */, 204 | 1B10F28722429706002141E5 /* Frameworks */, 205 | 1B10F28822429706002141E5 /* Resources */, 206 | ); 207 | buildRules = ( 208 | ); 209 | dependencies = ( 210 | 1B10F28C22429706002141E5 /* PBXTargetDependency */, 211 | ); 212 | name = NKAlertViewUITests; 213 | productName = NKAlertViewUITests; 214 | productReference = 1B10F28A22429706002141E5 /* NKAlertViewUITests.xctest */; 215 | productType = "com.apple.product-type.bundle.ui-testing"; 216 | }; 217 | /* End PBXNativeTarget section */ 218 | 219 | /* Begin PBXProject section */ 220 | 1B10F25F22429704002141E5 /* Project object */ = { 221 | isa = PBXProject; 222 | attributes = { 223 | LastUpgradeCheck = 1010; 224 | ORGANIZATIONNAME = "聂宽"; 225 | TargetAttributes = { 226 | 1B10F26622429704002141E5 = { 227 | CreatedOnToolsVersion = 10.1; 228 | }; 229 | 1B10F27E22429706002141E5 = { 230 | CreatedOnToolsVersion = 10.1; 231 | TestTargetID = 1B10F26622429704002141E5; 232 | }; 233 | 1B10F28922429706002141E5 = { 234 | CreatedOnToolsVersion = 10.1; 235 | TestTargetID = 1B10F26622429704002141E5; 236 | }; 237 | }; 238 | }; 239 | buildConfigurationList = 1B10F26222429704002141E5 /* Build configuration list for PBXProject "NKAlertView" */; 240 | compatibilityVersion = "Xcode 9.3"; 241 | developmentRegion = en; 242 | hasScannedForEncodings = 0; 243 | knownRegions = ( 244 | en, 245 | Base, 246 | ); 247 | mainGroup = 1B10F25E22429704002141E5; 248 | productRefGroup = 1B10F26822429704002141E5 /* Products */; 249 | projectDirPath = ""; 250 | projectRoot = ""; 251 | targets = ( 252 | 1B10F26622429704002141E5 /* NKAlertView */, 253 | 1B10F27E22429706002141E5 /* NKAlertViewTests */, 254 | 1B10F28922429706002141E5 /* NKAlertViewUITests */, 255 | ); 256 | }; 257 | /* End PBXProject section */ 258 | 259 | /* Begin PBXResourcesBuildPhase section */ 260 | 1B10F26522429704002141E5 /* Resources */ = { 261 | isa = PBXResourcesBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | 1B10F27722429706002141E5 /* LaunchScreen.storyboard in Resources */, 265 | 1B10F27422429706002141E5 /* Assets.xcassets in Resources */, 266 | 1B10F27222429704002141E5 /* Main.storyboard in Resources */, 267 | 1B10F30922433E97002141E5 /* shop_invite_icon.png in Resources */, 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | 1B10F27D22429706002141E5 /* Resources */ = { 272 | isa = PBXResourcesBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | 1B10F28822429706002141E5 /* Resources */ = { 279 | isa = PBXResourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | }; 285 | /* End PBXResourcesBuildPhase section */ 286 | 287 | /* Begin PBXSourcesBuildPhase section */ 288 | 1B10F26322429704002141E5 /* Sources */ = { 289 | isa = PBXSourcesBuildPhase; 290 | buildActionMask = 2147483647; 291 | files = ( 292 | 1B10F29F22429775002141E5 /* NKAlertView.m in Sources */, 293 | 1B10F26F22429704002141E5 /* ViewController.m in Sources */, 294 | 1B10F27A22429706002141E5 /* main.m in Sources */, 295 | 1B10F2A222429931002141E5 /* CenterAlertContentView.m in Sources */, 296 | 1B10F2A522429947002141E5 /* BottomAlertContentView.m in Sources */, 297 | 1B10F26C22429704002141E5 /* AppDelegate.m in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | 1B10F27B22429706002141E5 /* Sources */ = { 302 | isa = PBXSourcesBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | 1B10F28422429706002141E5 /* NKAlertViewTests.m in Sources */, 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | }; 309 | 1B10F28622429706002141E5 /* Sources */ = { 310 | isa = PBXSourcesBuildPhase; 311 | buildActionMask = 2147483647; 312 | files = ( 313 | 1B10F28F22429706002141E5 /* NKAlertViewUITests.m in Sources */, 314 | ); 315 | runOnlyForDeploymentPostprocessing = 0; 316 | }; 317 | /* End PBXSourcesBuildPhase section */ 318 | 319 | /* Begin PBXTargetDependency section */ 320 | 1B10F28122429706002141E5 /* PBXTargetDependency */ = { 321 | isa = PBXTargetDependency; 322 | target = 1B10F26622429704002141E5 /* NKAlertView */; 323 | targetProxy = 1B10F28022429706002141E5 /* PBXContainerItemProxy */; 324 | }; 325 | 1B10F28C22429706002141E5 /* PBXTargetDependency */ = { 326 | isa = PBXTargetDependency; 327 | target = 1B10F26622429704002141E5 /* NKAlertView */; 328 | targetProxy = 1B10F28B22429706002141E5 /* PBXContainerItemProxy */; 329 | }; 330 | /* End PBXTargetDependency section */ 331 | 332 | /* Begin PBXVariantGroup section */ 333 | 1B10F27022429704002141E5 /* Main.storyboard */ = { 334 | isa = PBXVariantGroup; 335 | children = ( 336 | 1B10F27122429704002141E5 /* Base */, 337 | ); 338 | name = Main.storyboard; 339 | sourceTree = ""; 340 | }; 341 | 1B10F27522429706002141E5 /* LaunchScreen.storyboard */ = { 342 | isa = PBXVariantGroup; 343 | children = ( 344 | 1B10F27622429706002141E5 /* Base */, 345 | ); 346 | name = LaunchScreen.storyboard; 347 | sourceTree = ""; 348 | }; 349 | /* End PBXVariantGroup section */ 350 | 351 | /* Begin XCBuildConfiguration section */ 352 | 1B10F29122429706002141E5 /* Debug */ = { 353 | isa = XCBuildConfiguration; 354 | buildSettings = { 355 | ALWAYS_SEARCH_USER_PATHS = NO; 356 | CLANG_ANALYZER_NONNULL = YES; 357 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 358 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 359 | CLANG_CXX_LIBRARY = "libc++"; 360 | CLANG_ENABLE_MODULES = YES; 361 | CLANG_ENABLE_OBJC_ARC = YES; 362 | CLANG_ENABLE_OBJC_WEAK = YES; 363 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 364 | CLANG_WARN_BOOL_CONVERSION = YES; 365 | CLANG_WARN_COMMA = YES; 366 | CLANG_WARN_CONSTANT_CONVERSION = YES; 367 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 368 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 369 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 370 | CLANG_WARN_EMPTY_BODY = YES; 371 | CLANG_WARN_ENUM_CONVERSION = YES; 372 | CLANG_WARN_INFINITE_RECURSION = YES; 373 | CLANG_WARN_INT_CONVERSION = YES; 374 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 375 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 376 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 377 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 378 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 379 | CLANG_WARN_STRICT_PROTOTYPES = YES; 380 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 381 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 382 | CLANG_WARN_UNREACHABLE_CODE = YES; 383 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 384 | CODE_SIGN_IDENTITY = "iPhone Developer"; 385 | COPY_PHASE_STRIP = NO; 386 | DEBUG_INFORMATION_FORMAT = dwarf; 387 | ENABLE_STRICT_OBJC_MSGSEND = YES; 388 | ENABLE_TESTABILITY = YES; 389 | GCC_C_LANGUAGE_STANDARD = gnu11; 390 | GCC_DYNAMIC_NO_PIC = NO; 391 | GCC_NO_COMMON_BLOCKS = YES; 392 | GCC_OPTIMIZATION_LEVEL = 0; 393 | GCC_PREPROCESSOR_DEFINITIONS = ( 394 | "DEBUG=1", 395 | "$(inherited)", 396 | ); 397 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 398 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 399 | GCC_WARN_UNDECLARED_SELECTOR = YES; 400 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 401 | GCC_WARN_UNUSED_FUNCTION = YES; 402 | GCC_WARN_UNUSED_VARIABLE = YES; 403 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 404 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 405 | MTL_FAST_MATH = YES; 406 | ONLY_ACTIVE_ARCH = YES; 407 | SDKROOT = iphoneos; 408 | }; 409 | name = Debug; 410 | }; 411 | 1B10F29222429706002141E5 /* Release */ = { 412 | isa = XCBuildConfiguration; 413 | buildSettings = { 414 | ALWAYS_SEARCH_USER_PATHS = NO; 415 | CLANG_ANALYZER_NONNULL = YES; 416 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 417 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 418 | CLANG_CXX_LIBRARY = "libc++"; 419 | CLANG_ENABLE_MODULES = YES; 420 | CLANG_ENABLE_OBJC_ARC = YES; 421 | CLANG_ENABLE_OBJC_WEAK = YES; 422 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 423 | CLANG_WARN_BOOL_CONVERSION = YES; 424 | CLANG_WARN_COMMA = YES; 425 | CLANG_WARN_CONSTANT_CONVERSION = YES; 426 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 427 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 428 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 429 | CLANG_WARN_EMPTY_BODY = YES; 430 | CLANG_WARN_ENUM_CONVERSION = YES; 431 | CLANG_WARN_INFINITE_RECURSION = YES; 432 | CLANG_WARN_INT_CONVERSION = YES; 433 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 434 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 435 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 436 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 437 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 438 | CLANG_WARN_STRICT_PROTOTYPES = YES; 439 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 440 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 441 | CLANG_WARN_UNREACHABLE_CODE = YES; 442 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 443 | CODE_SIGN_IDENTITY = "iPhone Developer"; 444 | COPY_PHASE_STRIP = NO; 445 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 446 | ENABLE_NS_ASSERTIONS = NO; 447 | ENABLE_STRICT_OBJC_MSGSEND = YES; 448 | GCC_C_LANGUAGE_STANDARD = gnu11; 449 | GCC_NO_COMMON_BLOCKS = YES; 450 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 451 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 452 | GCC_WARN_UNDECLARED_SELECTOR = YES; 453 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 454 | GCC_WARN_UNUSED_FUNCTION = YES; 455 | GCC_WARN_UNUSED_VARIABLE = YES; 456 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 457 | MTL_ENABLE_DEBUG_INFO = NO; 458 | MTL_FAST_MATH = YES; 459 | SDKROOT = iphoneos; 460 | VALIDATE_PRODUCT = YES; 461 | }; 462 | name = Release; 463 | }; 464 | 1B10F29422429706002141E5 /* Debug */ = { 465 | isa = XCBuildConfiguration; 466 | buildSettings = { 467 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 468 | CODE_SIGN_STYLE = Automatic; 469 | INFOPLIST_FILE = NKAlertView/Info.plist; 470 | LD_RUNPATH_SEARCH_PATHS = ( 471 | "$(inherited)", 472 | "@executable_path/Frameworks", 473 | ); 474 | PRODUCT_BUNDLE_IDENTIFIER = com.NKAlertView; 475 | PRODUCT_NAME = "$(TARGET_NAME)"; 476 | TARGETED_DEVICE_FAMILY = "1,2"; 477 | }; 478 | name = Debug; 479 | }; 480 | 1B10F29522429706002141E5 /* Release */ = { 481 | isa = XCBuildConfiguration; 482 | buildSettings = { 483 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 484 | CODE_SIGN_STYLE = Automatic; 485 | INFOPLIST_FILE = NKAlertView/Info.plist; 486 | LD_RUNPATH_SEARCH_PATHS = ( 487 | "$(inherited)", 488 | "@executable_path/Frameworks", 489 | ); 490 | PRODUCT_BUNDLE_IDENTIFIER = com.NKAlertView; 491 | PRODUCT_NAME = "$(TARGET_NAME)"; 492 | TARGETED_DEVICE_FAMILY = "1,2"; 493 | }; 494 | name = Release; 495 | }; 496 | 1B10F29722429706002141E5 /* Debug */ = { 497 | isa = XCBuildConfiguration; 498 | buildSettings = { 499 | BUNDLE_LOADER = "$(TEST_HOST)"; 500 | CODE_SIGN_STYLE = Automatic; 501 | INFOPLIST_FILE = NKAlertViewTests/Info.plist; 502 | LD_RUNPATH_SEARCH_PATHS = ( 503 | "$(inherited)", 504 | "@executable_path/Frameworks", 505 | "@loader_path/Frameworks", 506 | ); 507 | PRODUCT_BUNDLE_IDENTIFIER = com.NKAlertViewTests; 508 | PRODUCT_NAME = "$(TARGET_NAME)"; 509 | TARGETED_DEVICE_FAMILY = "1,2"; 510 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NKAlertView.app/NKAlertView"; 511 | }; 512 | name = Debug; 513 | }; 514 | 1B10F29822429706002141E5 /* Release */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | BUNDLE_LOADER = "$(TEST_HOST)"; 518 | CODE_SIGN_STYLE = Automatic; 519 | INFOPLIST_FILE = NKAlertViewTests/Info.plist; 520 | LD_RUNPATH_SEARCH_PATHS = ( 521 | "$(inherited)", 522 | "@executable_path/Frameworks", 523 | "@loader_path/Frameworks", 524 | ); 525 | PRODUCT_BUNDLE_IDENTIFIER = com.NKAlertViewTests; 526 | PRODUCT_NAME = "$(TARGET_NAME)"; 527 | TARGETED_DEVICE_FAMILY = "1,2"; 528 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NKAlertView.app/NKAlertView"; 529 | }; 530 | name = Release; 531 | }; 532 | 1B10F29A22429706002141E5 /* Debug */ = { 533 | isa = XCBuildConfiguration; 534 | buildSettings = { 535 | CODE_SIGN_STYLE = Automatic; 536 | INFOPLIST_FILE = NKAlertViewUITests/Info.plist; 537 | LD_RUNPATH_SEARCH_PATHS = ( 538 | "$(inherited)", 539 | "@executable_path/Frameworks", 540 | "@loader_path/Frameworks", 541 | ); 542 | PRODUCT_BUNDLE_IDENTIFIER = com.NKAlertViewUITests; 543 | PRODUCT_NAME = "$(TARGET_NAME)"; 544 | TARGETED_DEVICE_FAMILY = "1,2"; 545 | TEST_TARGET_NAME = NKAlertView; 546 | }; 547 | name = Debug; 548 | }; 549 | 1B10F29B22429706002141E5 /* Release */ = { 550 | isa = XCBuildConfiguration; 551 | buildSettings = { 552 | CODE_SIGN_STYLE = Automatic; 553 | INFOPLIST_FILE = NKAlertViewUITests/Info.plist; 554 | LD_RUNPATH_SEARCH_PATHS = ( 555 | "$(inherited)", 556 | "@executable_path/Frameworks", 557 | "@loader_path/Frameworks", 558 | ); 559 | PRODUCT_BUNDLE_IDENTIFIER = com.NKAlertViewUITests; 560 | PRODUCT_NAME = "$(TARGET_NAME)"; 561 | TARGETED_DEVICE_FAMILY = "1,2"; 562 | TEST_TARGET_NAME = NKAlertView; 563 | }; 564 | name = Release; 565 | }; 566 | /* End XCBuildConfiguration section */ 567 | 568 | /* Begin XCConfigurationList section */ 569 | 1B10F26222429704002141E5 /* Build configuration list for PBXProject "NKAlertView" */ = { 570 | isa = XCConfigurationList; 571 | buildConfigurations = ( 572 | 1B10F29122429706002141E5 /* Debug */, 573 | 1B10F29222429706002141E5 /* Release */, 574 | ); 575 | defaultConfigurationIsVisible = 0; 576 | defaultConfigurationName = Release; 577 | }; 578 | 1B10F29322429706002141E5 /* Build configuration list for PBXNativeTarget "NKAlertView" */ = { 579 | isa = XCConfigurationList; 580 | buildConfigurations = ( 581 | 1B10F29422429706002141E5 /* Debug */, 582 | 1B10F29522429706002141E5 /* Release */, 583 | ); 584 | defaultConfigurationIsVisible = 0; 585 | defaultConfigurationName = Release; 586 | }; 587 | 1B10F29622429706002141E5 /* Build configuration list for PBXNativeTarget "NKAlertViewTests" */ = { 588 | isa = XCConfigurationList; 589 | buildConfigurations = ( 590 | 1B10F29722429706002141E5 /* Debug */, 591 | 1B10F29822429706002141E5 /* Release */, 592 | ); 593 | defaultConfigurationIsVisible = 0; 594 | defaultConfigurationName = Release; 595 | }; 596 | 1B10F29922429706002141E5 /* Build configuration list for PBXNativeTarget "NKAlertViewUITests" */ = { 597 | isa = XCConfigurationList; 598 | buildConfigurations = ( 599 | 1B10F29A22429706002141E5 /* Debug */, 600 | 1B10F29B22429706002141E5 /* Release */, 601 | ); 602 | defaultConfigurationIsVisible = 0; 603 | defaultConfigurationName = Release; 604 | }; 605 | /* End XCConfigurationList section */ 606 | }; 607 | rootObject = 1B10F25F22429704002141E5 /* Project object */; 608 | } 609 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView.xcodeproj/project.xcworkspace/xcuserdata/niekuan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NK-iOS/NKAlertView/e7f6e93bc59f342c0055dffb73b439679fb4bae3/NKAlertView/NKAlertView.xcodeproj/project.xcworkspace/xcuserdata/niekuan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /NKAlertView/NKAlertView.xcodeproj/xcuserdata/niekuan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView.xcodeproj/xcuserdata/niekuan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | NKAlertView.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // NKAlertView 4 | // 5 | // Created by 聂宽 on 2019/3/20. 6 | // Copyright © 2019 聂宽. 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 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // NKAlertView 4 | // 5 | // Created by 聂宽 on 2019/3/20. 6 | // Copyright © 2019 聂宽. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/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 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/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 | 34 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/BottomAlertContentView.h: -------------------------------------------------------------------------------- 1 | // 2 | // BottomAlertContentView.h 3 | // NKAlertView 4 | // 5 | // Created by 聂宽 on 2019/3/20. 6 | // Copyright © 2019 聂宽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface BottomAlertContentView : UIView 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/BottomAlertContentView.m: -------------------------------------------------------------------------------- 1 | // 2 | // BottomAlertContentView.m 3 | // NKAlertView 4 | // 5 | // Created by 聂宽 on 2019/3/20. 6 | // Copyright © 2019 聂宽. All rights reserved. 7 | // 8 | 9 | #import "BottomAlertContentView.h" 10 | #import "NKAlertView.h" 11 | 12 | #define NKColorWithRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] 13 | 14 | @interface BottomAlertContentView () 15 | @property (nonatomic, strong) UITableView *tableView; 16 | 17 | @end 18 | 19 | @implementation BottomAlertContentView 20 | 21 | - (UITableView *)tableView 22 | { 23 | if (_tableView == nil) { 24 | _tableView = [[UITableView alloc] init]; 25 | _tableView.dataSource = self; 26 | _tableView.delegate = self; 27 | [self addSubview:_tableView]; 28 | } 29 | return _tableView; 30 | } 31 | 32 | - (instancetype)initWithFrame:(CGRect)frame 33 | { 34 | if (self = [super initWithFrame:frame]) { 35 | self.backgroundColor = [UIColor whiteColor]; 36 | 37 | UILabel *titleLab = [[UILabel alloc] init]; 38 | titleLab.textAlignment = NSTextAlignmentCenter; 39 | titleLab.text = @"Restaurant"; 40 | titleLab.textColor = [UIColor grayColor]; 41 | titleLab.font = [UIFont systemFontOfSize:16]; 42 | [self addSubview:titleLab]; 43 | titleLab.frame = CGRectMake(0, 0, CGRectGetWidth(frame), 50); 44 | 45 | self.tableView.frame = CGRectMake(0, CGRectGetMaxY(titleLab.frame), CGRectGetWidth(frame), CGRectGetHeight(frame) - 100); 46 | 47 | UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 48 | rightBtn.backgroundColor = NKColorWithRGB(0xFED953); 49 | rightBtn.tag = 12; 50 | [rightBtn setTitle:@"取消" forState:UIControlStateNormal]; 51 | [rightBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 52 | rightBtn.titleLabel.font = [UIFont systemFontOfSize:15]; 53 | [rightBtn addTarget:self action:@selector(botBtnClick:) forControlEvents:UIControlEventTouchUpInside]; 54 | [self addSubview:rightBtn]; 55 | rightBtn.frame = CGRectMake(0, CGRectGetHeight(frame) - 40, CGRectGetWidth(frame), 35); 56 | } 57 | return self; 58 | } 59 | 60 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 61 | { 62 | return 1; 63 | } 64 | 65 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 66 | { 67 | return 10; 68 | } 69 | 70 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 71 | { 72 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"]; 73 | if (cell == nil) { 74 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"UITableViewCell"]; 75 | } 76 | cell.textLabel.text = @"UITableViewCell"; 77 | return cell; 78 | } 79 | 80 | - (void)botBtnClick:(UIButton *)btn 81 | { 82 | NKAlertView *alertView = (NKAlertView *)self.superview; 83 | [alertView hide]; 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/CenterAlertContentView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CenterAlertContentView.h 3 | // NKAlertView 4 | // 5 | // Created by 聂宽 on 2019/3/20. 6 | // Copyright © 2019 聂宽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface CenterAlertContentView : UIView 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/CenterAlertContentView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CenterAlertContentView.m 3 | // NKAlertView 4 | // 5 | // Created by 聂宽 on 2019/3/20. 6 | // Copyright © 2019 聂宽. All rights reserved. 7 | // 8 | 9 | #import "CenterAlertContentView.h" 10 | #import "NKAlertView.h" 11 | 12 | #define NKColorWithRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] 13 | @implementation CenterAlertContentView 14 | 15 | - (instancetype)initWithFrame:(CGRect)frame 16 | { 17 | if (self = [super initWithFrame:frame]) { 18 | self.backgroundColor = [UIColor whiteColor]; 19 | self.layer.cornerRadius = 5; 20 | self.clipsToBounds = YES; 21 | 22 | UILabel *titleLab = [[UILabel alloc] init]; 23 | titleLab.textAlignment = NSTextAlignmentCenter; 24 | titleLab.text = @"Restaurant"; 25 | titleLab.textColor = [UIColor grayColor]; 26 | titleLab.font = [UIFont systemFontOfSize:16]; 27 | [self addSubview:titleLab]; 28 | titleLab.frame = CGRectMake(0, 0, CGRectGetWidth(frame), 50); 29 | 30 | // shop_invite_icon 31 | UIImageView *imgView = [[UIImageView alloc] init]; 32 | imgView.image = [UIImage imageNamed:@"shop_invite_icon"]; 33 | imgView.contentMode = UIViewContentModeScaleAspectFill; 34 | imgView.clipsToBounds = YES; 35 | [self addSubview:imgView]; 36 | imgView.frame = CGRectMake(20, CGRectGetMaxY(titleLab.frame) + 10, CGRectGetWidth(frame) - 40, CGRectGetHeight(frame) - (CGRectGetMaxY(titleLab.frame) + 10 + 60)); 37 | 38 | UIView *botVIew = [[UIView alloc] init]; 39 | botVIew.backgroundColor = NKColorWithRGB(0xEFEFF4); 40 | [self addSubview:botVIew]; 41 | botVIew.frame = CGRectMake(0, CGRectGetHeight(frame) - 50, CGRectGetWidth(frame), 50); 42 | 43 | UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 44 | leftBtn.backgroundColor = [UIColor whiteColor]; 45 | leftBtn.tag = 11; 46 | [leftBtn setTitle:@"Cancel" forState:UIControlStateNormal]; 47 | [leftBtn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; 48 | leftBtn.titleLabel.font = [UIFont systemFontOfSize:15]; 49 | [leftBtn addTarget:self action:@selector(botBtnClick:) forControlEvents:UIControlEventTouchUpInside]; 50 | [botVIew addSubview:leftBtn]; 51 | leftBtn.frame = CGRectMake(0, 1, (CGRectGetWidth(frame) - 1) * 0.5, 49); 52 | 53 | UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 54 | rightBtn.backgroundColor = [UIColor whiteColor]; 55 | rightBtn.tag = 12; 56 | [rightBtn setTitle:@"Invite friend" forState:UIControlStateNormal]; 57 | [rightBtn setTitleColor:NKColorWithRGB(0xFED953) forState:UIControlStateNormal]; 58 | rightBtn.titleLabel.font = [UIFont systemFontOfSize:15]; 59 | [rightBtn addTarget:self action:@selector(botBtnClick:) forControlEvents:UIControlEventTouchUpInside]; 60 | [botVIew addSubview:rightBtn]; 61 | rightBtn.frame = CGRectMake((CGRectGetWidth(frame) - 1) * 0.5 + 1, 1, (CGRectGetWidth(frame) - 1) * 0.5, 49); 62 | } 63 | return self; 64 | } 65 | 66 | - (void)botBtnClick:(UIButton *)btn 67 | { 68 | NKAlertView *alertView = (NKAlertView *)self.superview; 69 | [alertView hide]; 70 | if (btn.tag == 11) { 71 | 72 | }else 73 | { 74 | 75 | } 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/NKAlertView/NKAlertView.h: -------------------------------------------------------------------------------- 1 | // 2 | // NKAlertView.h 3 | // General 4 | // 5 | // Created by 聂宽 on 2018/11/30. 6 | // Copyright © 2018年 聂宽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum : NSUInteger { 12 | // 从中间弹出 13 | NKAlertViewTypeDef, 14 | // 从底部弹出 15 | NKAlertViewTypeBottom 16 | } NKAlertViewType; 17 | 18 | @interface NKAlertView : UIView 19 | 20 | @property (nonatomic, assign) NKAlertViewType type; 21 | @property (nonatomic, strong) UIView *contentView; 22 | 23 | // 点击背景时候隐藏alert 24 | @property (nonatomic, assign) BOOL hiddenWhenTapBG; 25 | 26 | // Show the alert view in current window 27 | - (void)show; 28 | 29 | // Hide the alert view 30 | - (void)hide; 31 | @end 32 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/NKAlertView/NKAlertView.m: -------------------------------------------------------------------------------- 1 | // 2 | // NKAlertView.m 3 | // General 4 | // 5 | // Created by 聂宽 on 2018/11/30. 6 | // Copyright © 2018年 聂宽. All rights reserved. 7 | // 8 | 9 | #import "NKAlertView.h" 10 | 11 | @interface NKAlertView () 12 | @property (nonatomic, strong) UIView *bgView; 13 | @end 14 | 15 | @implementation NKAlertView 16 | - (UIView *)bgView 17 | { 18 | if (_bgView == nil) { 19 | _bgView = [[UIView alloc] initWithFrame:self.bounds]; 20 | if (self.contentView) { 21 | [self insertSubview:_bgView belowSubview:self.contentView]; 22 | }else 23 | { 24 | [self addSubview:_bgView]; 25 | } 26 | } 27 | return _bgView; 28 | } 29 | 30 | - (instancetype)init 31 | { 32 | if (self = [super init]) { 33 | self.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height); 34 | self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3]; 35 | self.alpha = 0; 36 | [[UIApplication sharedApplication].keyWindow addSubview:self]; 37 | } 38 | return self; 39 | } 40 | 41 | - (void)show 42 | { 43 | if (self.type == NKAlertViewTypeBottom) { 44 | [UIView animateWithDuration:0.25 animations:^{ 45 | self.alpha = 1.0; 46 | self.contentView.transform = CGAffineTransformMakeTranslation(0, -self.contentView.bounds.size.height); 47 | } completion:nil]; 48 | }else 49 | { 50 | self.alpha = 1.0; 51 | CAKeyframeAnimation * animation; 52 | animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 53 | animation.duration = 0.30; 54 | animation.removedOnCompletion = YES; 55 | animation.fillMode = kCAFillModeForwards; 56 | NSMutableArray *values = [NSMutableArray array]; 57 | [values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.9, 0.9, 1.0)]]; 58 | [values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.1, 1.1, 1.0)]]; 59 | [values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)]]; 60 | animation.values = values; 61 | [_contentView.layer addAnimation:animation forKey:nil]; 62 | } 63 | } 64 | 65 | - (void)hide 66 | { 67 | [UIView animateWithDuration:0.25 animations:^{ 68 | self.alpha = 0; 69 | self.contentView.transform = CGAffineTransformIdentity; 70 | } completion:^(BOOL finished) { 71 | [self removeFromSuperview]; 72 | }]; 73 | } 74 | 75 | #pragma mark - set 76 | - (void)setType:(NKAlertViewType)type 77 | { 78 | _type = type; 79 | if (self.contentView && _type == NKAlertViewTypeBottom) { 80 | _contentView.frame = CGRectMake((CGRectGetMaxX(self.frame) - CGRectGetWidth(_contentView.frame)) * 0.5, CGRectGetMaxY(self.frame), CGRectGetWidth(_contentView.frame), CGRectGetHeight(_contentView.frame)); 81 | UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:_contentView.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(10, 10)]; 82 | CAShapeLayer *shapeLayer = [CAShapeLayer layer]; 83 | shapeLayer.frame = _contentView.bounds; 84 | shapeLayer.path = path.CGPath; 85 | _contentView.layer.mask = shapeLayer; 86 | } 87 | } 88 | 89 | - (void)setContentView:(UIView *)contentView 90 | { 91 | _contentView = contentView; 92 | if (self.type == NKAlertViewTypeBottom) { 93 | _contentView.frame = CGRectMake((CGRectGetMaxX(self.frame) - CGRectGetWidth(_contentView.frame)) * 0.5, CGRectGetMaxY(self.frame), CGRectGetWidth(_contentView.frame), CGRectGetHeight(_contentView.frame)); 94 | /* 95 | 利用贝塞尔曲线为contentView的左上角、右上角设置圆角; 96 | 如果不需要可以注释下边代码 97 | */ 98 | UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:_contentView.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(10, 10)]; 99 | CAShapeLayer *shapeLayer = [CAShapeLayer layer]; 100 | shapeLayer.frame = _contentView.bounds; 101 | shapeLayer.path = path.CGPath; 102 | _contentView.layer.mask = shapeLayer; 103 | }else 104 | { 105 | _contentView.center = self.center; 106 | } 107 | [self addSubview:_contentView]; 108 | } 109 | 110 | - (void)setHiddenWhenTapBG:(BOOL)hiddenWhenTapBG 111 | { 112 | _hiddenWhenTapBG = hiddenWhenTapBG; 113 | if (_hiddenWhenTapBG) { 114 | [self.bgView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)]]; 115 | } 116 | } 117 | 118 | @end 119 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // NKAlertView 4 | // 5 | // Created by 聂宽 on 2019/3/20. 6 | // Copyright © 2019 聂宽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // NKAlertView 4 | // 5 | // Created by 聂宽 on 2019/3/20. 6 | // Copyright © 2019 聂宽. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "NKAlertView.h" 11 | #import "CenterAlertContentView.h" 12 | #import "BottomAlertContentView.h" 13 | 14 | @interface ViewController () 15 | 16 | @end 17 | 18 | @implementation ViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view, typically from a nib. 23 | } 24 | 25 | // 从中间弹出 26 | - (IBAction)centerAlertAction:(id)sender { 27 | NKAlertView *alertView = [[NKAlertView alloc] init]; 28 | CenterAlertContentView *customContentView = [[CenterAlertContentView alloc] initWithFrame:CGRectMake(0, 0, 281, 281)]; 29 | alertView.contentView = customContentView; 30 | // 点击背景隐藏提示框 31 | // alertView.hiddenWhenTapBG = YES; 32 | [alertView show]; 33 | } 34 | 35 | // 从底部弹出 36 | - (IBAction)bottomAlertAction:(id)sender { 37 | NKAlertView *alertView = [[NKAlertView alloc] init]; 38 | BottomAlertContentView *customContentView = [[BottomAlertContentView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 400)]; 39 | alertView.type = NKAlertViewTypeBottom; 40 | alertView.contentView = customContentView; 41 | alertView.hiddenWhenTapBG = YES; 42 | [alertView show]; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // NKAlertView 4 | // 5 | // Created by 聂宽 on 2019/3/20. 6 | // Copyright © 2019 聂宽. 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 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertView/shop_invite_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NK-iOS/NKAlertView/e7f6e93bc59f342c0055dffb73b439679fb4bae3/NKAlertView/NKAlertView/shop_invite_icon.png -------------------------------------------------------------------------------- /NKAlertView/NKAlertViewTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertViewTests/NKAlertViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NKAlertViewTests.m 3 | // NKAlertViewTests 4 | // 5 | // Created by 聂宽 on 2019/3/20. 6 | // Copyright © 2019 聂宽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NKAlertViewTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation NKAlertViewTests 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | } 20 | 21 | - (void)tearDown { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | - (void)testExample { 26 | // This is an example of a functional test case. 27 | // Use XCTAssert and related functions to verify your tests produce the correct results. 28 | } 29 | 30 | - (void)testPerformanceExample { 31 | // This is an example of a performance test case. 32 | [self measureBlock:^{ 33 | // Put the code you want to measure the time of here. 34 | }]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertViewUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /NKAlertView/NKAlertViewUITests/NKAlertViewUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NKAlertViewUITests.m 3 | // NKAlertViewUITests 4 | // 5 | // Created by 聂宽 on 2019/3/20. 6 | // Copyright © 2019 聂宽. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NKAlertViewUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation NKAlertViewUITests 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | 20 | // In UI tests it is usually best to stop immediately when a failure occurs. 21 | self.continueAfterFailure = NO; 22 | 23 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 24 | [[[XCUIApplication alloc] init] launch]; 25 | 26 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 27 | } 28 | 29 | - (void)tearDown { 30 | // Put teardown code here. This method is called after the invocation of each test method in the class. 31 | } 32 | 33 | - (void)testExample { 34 | // Use recording to get started writing UI tests. 35 | // Use XCTAssert and related functions to verify your tests produce the correct results. 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NKAlertView 2 | ### 我们自定义AlertView: 3 | 下边CenterAlertContentView是自定义contentView 4 | ``` 5 | // 从中间弹出 6 | - (IBAction)centerAlertAction:(id)sender { 7 | NKAlertView *alertView = [[NKAlertView alloc] init]; 8 | CenterAlertContentView *customContentView = [[CenterAlertContentView alloc] initWithFrame:CGRectMake(0, 0, 281, 281)]; 9 | alertView.contentView = customContentView; 10 | // 点击背景隐藏提示框 11 | alertView.hiddenWhenTapBG = YES; 12 | [alertView show]; 13 | } 14 | ``` 15 | 16 | 效果: 17 | ![2019-03-21 12_47_59.gif](https://upload-images.jianshu.io/upload_images/1721864-573fbe9016ea6b4a.gif?imageMogr2/auto-orient/strip) 18 | 19 | ### 其他 20 | * 自由开发者交流群:811483008 21 | * 附上:[简书](https://www.jianshu.com/p/95dfc1514584) 22 | --------------------------------------------------------------------------------