├── .gitignore ├── README.md ├── SplashViewSample.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── SplashViewSample ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── SplashView.swift ├── ViewController.swift └── default_img.png ├── SplashViewSampleTests ├── Info.plist └── SplashViewSampleTests.swift └── SplashViewSampleUITests ├── Info.plist └── SplashViewSampleUITests.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # iOS-SplashView 2 | 关于 SplashView 详细接受可以参考 Android 版: [SplashView-一行代码解决闪屏页-广告页-Android-篇](http://jkyeo.com/2016/07/10/SplashView-一行代码解决闪屏页-广告页-Android-篇/) 3 | 4 | 5 | 6 | iOS 效果: 7 | 8 | ![Default Splash Demo](http://ww3.sinaimg.cn/large/006tNc79gw1f5p7bukwkhg30b00k0b29.gif) ![Normal Splash Demo](http://ww3.sinaimg.cn/large/006tNc79gw1f5p7bp26p0g30aw0k0hdw.gif) 9 | 10 | 显示 SplashView 静态方法: 11 | 12 | ```swift 13 | class func simpleShowSplashView() 14 | ``` 15 | 16 | 也可以自定义超时时间、默认 Image、回到 Block: 17 | 18 | ```swift 19 | class func showSplashView(duration: Int = 6, 20 | defaultImage: UIImage?, 21 | tapSplashImageBlock: ((actionUrl: String?) -> Void)?, 22 | splashViewDismissBlock: ((initiativeDismiss: Bool) -> Void)?) 23 | ``` 24 | 25 |
需要注意的是:以上两个方法都需要至少在 UIViewController 的 View 显示之后 (即: override func viewDidAppear(animated: Bool)) 再调用才能达到显示 SplashView 的效果。
26 | 27 | 可以在任何地方更新 SplashView data: 28 | 29 | ```swift 30 | class func updateSplashData(imgUrl: String?, actUrl: String?) 31 | ``` 32 | 33 | 详情见博文:[SplashView - 一行代码解决闪屏页(广告页) - Android 篇](http://jkyeo.com/2016/07/10/SplashView-一行代码解决闪屏页-广告页-Android-篇/) 34 | -------------------------------------------------------------------------------- /SplashViewSample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | CABC376E1D328B4900722C65 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABC376D1D328B4900722C65 /* AppDelegate.swift */; }; 11 | CABC37701D328B4900722C65 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABC376F1D328B4900722C65 /* ViewController.swift */; }; 12 | CABC37731D328B4900722C65 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CABC37711D328B4900722C65 /* Main.storyboard */; }; 13 | CABC37751D328B4900722C65 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CABC37741D328B4900722C65 /* Assets.xcassets */; }; 14 | CABC37781D328B4900722C65 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CABC37761D328B4900722C65 /* LaunchScreen.storyboard */; }; 15 | CABC37831D328B4900722C65 /* SplashViewSampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABC37821D328B4900722C65 /* SplashViewSampleTests.swift */; }; 16 | CABC378E1D328B4900722C65 /* SplashViewSampleUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABC378D1D328B4900722C65 /* SplashViewSampleUITests.swift */; }; 17 | CABC379C1D328BF600722C65 /* SplashView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABC379B1D328BF600722C65 /* SplashView.swift */; }; 18 | CABC37A01D32916000722C65 /* default_img.png in Resources */ = {isa = PBXBuildFile; fileRef = CABC379F1D32916000722C65 /* default_img.png */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | CABC377F1D328B4900722C65 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = CABC37621D328B4800722C65 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = CABC37691D328B4800722C65; 27 | remoteInfo = SplashViewSample; 28 | }; 29 | CABC378A1D328B4900722C65 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = CABC37621D328B4800722C65 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = CABC37691D328B4800722C65; 34 | remoteInfo = SplashViewSample; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | CABC376A1D328B4800722C65 /* SplashViewSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SplashViewSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | CABC376D1D328B4900722C65 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 41 | CABC376F1D328B4900722C65 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 42 | CABC37721D328B4900722C65 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 43 | CABC37741D328B4900722C65 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 44 | CABC37771D328B4900722C65 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 45 | CABC37791D328B4900722C65 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | CABC377E1D328B4900722C65 /* SplashViewSampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SplashViewSampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | CABC37821D328B4900722C65 /* SplashViewSampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplashViewSampleTests.swift; sourceTree = ""; }; 48 | CABC37841D328B4900722C65 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | CABC37891D328B4900722C65 /* SplashViewSampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SplashViewSampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | CABC378D1D328B4900722C65 /* SplashViewSampleUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplashViewSampleUITests.swift; sourceTree = ""; }; 51 | CABC378F1D328B4900722C65 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | CABC379B1D328BF600722C65 /* SplashView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SplashView.swift; sourceTree = ""; }; 53 | CABC379F1D32916000722C65 /* default_img.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = default_img.png; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | CABC37671D328B4800722C65 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | CABC377B1D328B4900722C65 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | CABC37861D328B4900722C65 /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | /* End PBXFrameworksBuildPhase section */ 79 | 80 | /* Begin PBXGroup section */ 81 | CABC37611D328B4800722C65 = { 82 | isa = PBXGroup; 83 | children = ( 84 | CABC376C1D328B4900722C65 /* SplashViewSample */, 85 | CABC37811D328B4900722C65 /* SplashViewSampleTests */, 86 | CABC378C1D328B4900722C65 /* SplashViewSampleUITests */, 87 | CABC376B1D328B4800722C65 /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | CABC376B1D328B4800722C65 /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | CABC376A1D328B4800722C65 /* SplashViewSample.app */, 95 | CABC377E1D328B4900722C65 /* SplashViewSampleTests.xctest */, 96 | CABC37891D328B4900722C65 /* SplashViewSampleUITests.xctest */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | CABC376C1D328B4900722C65 /* SplashViewSample */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | CABC379F1D32916000722C65 /* default_img.png */, 105 | CABC379B1D328BF600722C65 /* SplashView.swift */, 106 | CABC376D1D328B4900722C65 /* AppDelegate.swift */, 107 | CABC376F1D328B4900722C65 /* ViewController.swift */, 108 | CABC37711D328B4900722C65 /* Main.storyboard */, 109 | CABC37741D328B4900722C65 /* Assets.xcassets */, 110 | CABC37761D328B4900722C65 /* LaunchScreen.storyboard */, 111 | CABC37791D328B4900722C65 /* Info.plist */, 112 | ); 113 | path = SplashViewSample; 114 | sourceTree = ""; 115 | }; 116 | CABC37811D328B4900722C65 /* SplashViewSampleTests */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | CABC37821D328B4900722C65 /* SplashViewSampleTests.swift */, 120 | CABC37841D328B4900722C65 /* Info.plist */, 121 | ); 122 | path = SplashViewSampleTests; 123 | sourceTree = ""; 124 | }; 125 | CABC378C1D328B4900722C65 /* SplashViewSampleUITests */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | CABC378D1D328B4900722C65 /* SplashViewSampleUITests.swift */, 129 | CABC378F1D328B4900722C65 /* Info.plist */, 130 | ); 131 | path = SplashViewSampleUITests; 132 | sourceTree = ""; 133 | }; 134 | /* End PBXGroup section */ 135 | 136 | /* Begin PBXNativeTarget section */ 137 | CABC37691D328B4800722C65 /* SplashViewSample */ = { 138 | isa = PBXNativeTarget; 139 | buildConfigurationList = CABC37921D328B4900722C65 /* Build configuration list for PBXNativeTarget "SplashViewSample" */; 140 | buildPhases = ( 141 | CABC37661D328B4800722C65 /* Sources */, 142 | CABC37671D328B4800722C65 /* Frameworks */, 143 | CABC37681D328B4800722C65 /* Resources */, 144 | ); 145 | buildRules = ( 146 | ); 147 | dependencies = ( 148 | ); 149 | name = SplashViewSample; 150 | productName = SplashViewSample; 151 | productReference = CABC376A1D328B4800722C65 /* SplashViewSample.app */; 152 | productType = "com.apple.product-type.application"; 153 | }; 154 | CABC377D1D328B4900722C65 /* SplashViewSampleTests */ = { 155 | isa = PBXNativeTarget; 156 | buildConfigurationList = CABC37951D328B4900722C65 /* Build configuration list for PBXNativeTarget "SplashViewSampleTests" */; 157 | buildPhases = ( 158 | CABC377A1D328B4900722C65 /* Sources */, 159 | CABC377B1D328B4900722C65 /* Frameworks */, 160 | CABC377C1D328B4900722C65 /* Resources */, 161 | ); 162 | buildRules = ( 163 | ); 164 | dependencies = ( 165 | CABC37801D328B4900722C65 /* PBXTargetDependency */, 166 | ); 167 | name = SplashViewSampleTests; 168 | productName = SplashViewSampleTests; 169 | productReference = CABC377E1D328B4900722C65 /* SplashViewSampleTests.xctest */; 170 | productType = "com.apple.product-type.bundle.unit-test"; 171 | }; 172 | CABC37881D328B4900722C65 /* SplashViewSampleUITests */ = { 173 | isa = PBXNativeTarget; 174 | buildConfigurationList = CABC37981D328B4900722C65 /* Build configuration list for PBXNativeTarget "SplashViewSampleUITests" */; 175 | buildPhases = ( 176 | CABC37851D328B4900722C65 /* Sources */, 177 | CABC37861D328B4900722C65 /* Frameworks */, 178 | CABC37871D328B4900722C65 /* Resources */, 179 | ); 180 | buildRules = ( 181 | ); 182 | dependencies = ( 183 | CABC378B1D328B4900722C65 /* PBXTargetDependency */, 184 | ); 185 | name = SplashViewSampleUITests; 186 | productName = SplashViewSampleUITests; 187 | productReference = CABC37891D328B4900722C65 /* SplashViewSampleUITests.xctest */; 188 | productType = "com.apple.product-type.bundle.ui-testing"; 189 | }; 190 | /* End PBXNativeTarget section */ 191 | 192 | /* Begin PBXProject section */ 193 | CABC37621D328B4800722C65 /* Project object */ = { 194 | isa = PBXProject; 195 | attributes = { 196 | LastSwiftUpdateCheck = 0730; 197 | LastUpgradeCheck = 0730; 198 | ORGANIZATIONNAME = jkyeo; 199 | TargetAttributes = { 200 | CABC37691D328B4800722C65 = { 201 | CreatedOnToolsVersion = 7.3.1; 202 | DevelopmentTeam = CFH2833EZ8; 203 | }; 204 | CABC377D1D328B4900722C65 = { 205 | CreatedOnToolsVersion = 7.3.1; 206 | DevelopmentTeam = CFH2833EZ8; 207 | TestTargetID = CABC37691D328B4800722C65; 208 | }; 209 | CABC37881D328B4900722C65 = { 210 | CreatedOnToolsVersion = 7.3.1; 211 | DevelopmentTeam = CFH2833EZ8; 212 | TestTargetID = CABC37691D328B4800722C65; 213 | }; 214 | }; 215 | }; 216 | buildConfigurationList = CABC37651D328B4800722C65 /* Build configuration list for PBXProject "SplashViewSample" */; 217 | compatibilityVersion = "Xcode 3.2"; 218 | developmentRegion = English; 219 | hasScannedForEncodings = 0; 220 | knownRegions = ( 221 | en, 222 | Base, 223 | ); 224 | mainGroup = CABC37611D328B4800722C65; 225 | productRefGroup = CABC376B1D328B4800722C65 /* Products */; 226 | projectDirPath = ""; 227 | projectRoot = ""; 228 | targets = ( 229 | CABC37691D328B4800722C65 /* SplashViewSample */, 230 | CABC377D1D328B4900722C65 /* SplashViewSampleTests */, 231 | CABC37881D328B4900722C65 /* SplashViewSampleUITests */, 232 | ); 233 | }; 234 | /* End PBXProject section */ 235 | 236 | /* Begin PBXResourcesBuildPhase section */ 237 | CABC37681D328B4800722C65 /* Resources */ = { 238 | isa = PBXResourcesBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | CABC37A01D32916000722C65 /* default_img.png in Resources */, 242 | CABC37781D328B4900722C65 /* LaunchScreen.storyboard in Resources */, 243 | CABC37751D328B4900722C65 /* Assets.xcassets in Resources */, 244 | CABC37731D328B4900722C65 /* Main.storyboard in Resources */, 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | CABC377C1D328B4900722C65 /* Resources */ = { 249 | isa = PBXResourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | CABC37871D328B4900722C65 /* Resources */ = { 256 | isa = PBXResourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | /* End PBXResourcesBuildPhase section */ 263 | 264 | /* Begin PBXSourcesBuildPhase section */ 265 | CABC37661D328B4800722C65 /* Sources */ = { 266 | isa = PBXSourcesBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | CABC37701D328B4900722C65 /* ViewController.swift in Sources */, 270 | CABC376E1D328B4900722C65 /* AppDelegate.swift in Sources */, 271 | CABC379C1D328BF600722C65 /* SplashView.swift in Sources */, 272 | ); 273 | runOnlyForDeploymentPostprocessing = 0; 274 | }; 275 | CABC377A1D328B4900722C65 /* Sources */ = { 276 | isa = PBXSourcesBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | CABC37831D328B4900722C65 /* SplashViewSampleTests.swift in Sources */, 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | }; 283 | CABC37851D328B4900722C65 /* Sources */ = { 284 | isa = PBXSourcesBuildPhase; 285 | buildActionMask = 2147483647; 286 | files = ( 287 | CABC378E1D328B4900722C65 /* SplashViewSampleUITests.swift in Sources */, 288 | ); 289 | runOnlyForDeploymentPostprocessing = 0; 290 | }; 291 | /* End PBXSourcesBuildPhase section */ 292 | 293 | /* Begin PBXTargetDependency section */ 294 | CABC37801D328B4900722C65 /* PBXTargetDependency */ = { 295 | isa = PBXTargetDependency; 296 | target = CABC37691D328B4800722C65 /* SplashViewSample */; 297 | targetProxy = CABC377F1D328B4900722C65 /* PBXContainerItemProxy */; 298 | }; 299 | CABC378B1D328B4900722C65 /* PBXTargetDependency */ = { 300 | isa = PBXTargetDependency; 301 | target = CABC37691D328B4800722C65 /* SplashViewSample */; 302 | targetProxy = CABC378A1D328B4900722C65 /* PBXContainerItemProxy */; 303 | }; 304 | /* End PBXTargetDependency section */ 305 | 306 | /* Begin PBXVariantGroup section */ 307 | CABC37711D328B4900722C65 /* Main.storyboard */ = { 308 | isa = PBXVariantGroup; 309 | children = ( 310 | CABC37721D328B4900722C65 /* Base */, 311 | ); 312 | name = Main.storyboard; 313 | sourceTree = ""; 314 | }; 315 | CABC37761D328B4900722C65 /* LaunchScreen.storyboard */ = { 316 | isa = PBXVariantGroup; 317 | children = ( 318 | CABC37771D328B4900722C65 /* Base */, 319 | ); 320 | name = LaunchScreen.storyboard; 321 | sourceTree = ""; 322 | }; 323 | /* End PBXVariantGroup section */ 324 | 325 | /* Begin XCBuildConfiguration section */ 326 | CABC37901D328B4900722C65 /* Debug */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | ALWAYS_SEARCH_USER_PATHS = NO; 330 | CLANG_ANALYZER_NONNULL = YES; 331 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 332 | CLANG_CXX_LIBRARY = "libc++"; 333 | CLANG_ENABLE_MODULES = YES; 334 | CLANG_ENABLE_OBJC_ARC = YES; 335 | CLANG_WARN_BOOL_CONVERSION = YES; 336 | CLANG_WARN_CONSTANT_CONVERSION = YES; 337 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 338 | CLANG_WARN_EMPTY_BODY = YES; 339 | CLANG_WARN_ENUM_CONVERSION = YES; 340 | CLANG_WARN_INT_CONVERSION = YES; 341 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 342 | CLANG_WARN_UNREACHABLE_CODE = YES; 343 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 344 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 345 | COPY_PHASE_STRIP = NO; 346 | DEBUG_INFORMATION_FORMAT = dwarf; 347 | ENABLE_STRICT_OBJC_MSGSEND = YES; 348 | ENABLE_TESTABILITY = YES; 349 | GCC_C_LANGUAGE_STANDARD = gnu99; 350 | GCC_DYNAMIC_NO_PIC = NO; 351 | GCC_NO_COMMON_BLOCKS = YES; 352 | GCC_OPTIMIZATION_LEVEL = 0; 353 | GCC_PREPROCESSOR_DEFINITIONS = ( 354 | "DEBUG=1", 355 | "$(inherited)", 356 | ); 357 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 358 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 359 | GCC_WARN_UNDECLARED_SELECTOR = YES; 360 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 361 | GCC_WARN_UNUSED_FUNCTION = YES; 362 | GCC_WARN_UNUSED_VARIABLE = YES; 363 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 364 | MTL_ENABLE_DEBUG_INFO = YES; 365 | ONLY_ACTIVE_ARCH = YES; 366 | SDKROOT = iphoneos; 367 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 368 | TARGETED_DEVICE_FAMILY = "1,2"; 369 | }; 370 | name = Debug; 371 | }; 372 | CABC37911D328B4900722C65 /* Release */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | ALWAYS_SEARCH_USER_PATHS = NO; 376 | CLANG_ANALYZER_NONNULL = YES; 377 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 378 | CLANG_CXX_LIBRARY = "libc++"; 379 | CLANG_ENABLE_MODULES = YES; 380 | CLANG_ENABLE_OBJC_ARC = YES; 381 | CLANG_WARN_BOOL_CONVERSION = YES; 382 | CLANG_WARN_CONSTANT_CONVERSION = YES; 383 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 384 | CLANG_WARN_EMPTY_BODY = YES; 385 | CLANG_WARN_ENUM_CONVERSION = YES; 386 | CLANG_WARN_INT_CONVERSION = YES; 387 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 388 | CLANG_WARN_UNREACHABLE_CODE = YES; 389 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 390 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 391 | COPY_PHASE_STRIP = NO; 392 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 393 | ENABLE_NS_ASSERTIONS = NO; 394 | ENABLE_STRICT_OBJC_MSGSEND = YES; 395 | GCC_C_LANGUAGE_STANDARD = gnu99; 396 | GCC_NO_COMMON_BLOCKS = YES; 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 = 9.3; 404 | MTL_ENABLE_DEBUG_INFO = NO; 405 | SDKROOT = iphoneos; 406 | TARGETED_DEVICE_FAMILY = "1,2"; 407 | VALIDATE_PRODUCT = YES; 408 | }; 409 | name = Release; 410 | }; 411 | CABC37931D328B4900722C65 /* Debug */ = { 412 | isa = XCBuildConfiguration; 413 | buildSettings = { 414 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 415 | INFOPLIST_FILE = SplashViewSample/Info.plist; 416 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 417 | PRODUCT_BUNDLE_IDENTIFIER = com.jkyeo.SplashViewSample; 418 | PRODUCT_NAME = "$(TARGET_NAME)"; 419 | }; 420 | name = Debug; 421 | }; 422 | CABC37941D328B4900722C65 /* Release */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 426 | INFOPLIST_FILE = SplashViewSample/Info.plist; 427 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 428 | PRODUCT_BUNDLE_IDENTIFIER = com.jkyeo.SplashViewSample; 429 | PRODUCT_NAME = "$(TARGET_NAME)"; 430 | }; 431 | name = Release; 432 | }; 433 | CABC37961D328B4900722C65 /* Debug */ = { 434 | isa = XCBuildConfiguration; 435 | buildSettings = { 436 | BUNDLE_LOADER = "$(TEST_HOST)"; 437 | INFOPLIST_FILE = SplashViewSampleTests/Info.plist; 438 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 439 | PRODUCT_BUNDLE_IDENTIFIER = com.jkyeo.SplashViewSampleTests; 440 | PRODUCT_NAME = "$(TARGET_NAME)"; 441 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SplashViewSample.app/SplashViewSample"; 442 | }; 443 | name = Debug; 444 | }; 445 | CABC37971D328B4900722C65 /* Release */ = { 446 | isa = XCBuildConfiguration; 447 | buildSettings = { 448 | BUNDLE_LOADER = "$(TEST_HOST)"; 449 | INFOPLIST_FILE = SplashViewSampleTests/Info.plist; 450 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 451 | PRODUCT_BUNDLE_IDENTIFIER = com.jkyeo.SplashViewSampleTests; 452 | PRODUCT_NAME = "$(TARGET_NAME)"; 453 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SplashViewSample.app/SplashViewSample"; 454 | }; 455 | name = Release; 456 | }; 457 | CABC37991D328B4900722C65 /* Debug */ = { 458 | isa = XCBuildConfiguration; 459 | buildSettings = { 460 | INFOPLIST_FILE = SplashViewSampleUITests/Info.plist; 461 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 462 | PRODUCT_BUNDLE_IDENTIFIER = com.jkyeo.SplashViewSampleUITests; 463 | PRODUCT_NAME = "$(TARGET_NAME)"; 464 | TEST_TARGET_NAME = SplashViewSample; 465 | }; 466 | name = Debug; 467 | }; 468 | CABC379A1D328B4900722C65 /* Release */ = { 469 | isa = XCBuildConfiguration; 470 | buildSettings = { 471 | INFOPLIST_FILE = SplashViewSampleUITests/Info.plist; 472 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 473 | PRODUCT_BUNDLE_IDENTIFIER = com.jkyeo.SplashViewSampleUITests; 474 | PRODUCT_NAME = "$(TARGET_NAME)"; 475 | TEST_TARGET_NAME = SplashViewSample; 476 | }; 477 | name = Release; 478 | }; 479 | /* End XCBuildConfiguration section */ 480 | 481 | /* Begin XCConfigurationList section */ 482 | CABC37651D328B4800722C65 /* Build configuration list for PBXProject "SplashViewSample" */ = { 483 | isa = XCConfigurationList; 484 | buildConfigurations = ( 485 | CABC37901D328B4900722C65 /* Debug */, 486 | CABC37911D328B4900722C65 /* Release */, 487 | ); 488 | defaultConfigurationIsVisible = 0; 489 | defaultConfigurationName = Release; 490 | }; 491 | CABC37921D328B4900722C65 /* Build configuration list for PBXNativeTarget "SplashViewSample" */ = { 492 | isa = XCConfigurationList; 493 | buildConfigurations = ( 494 | CABC37931D328B4900722C65 /* Debug */, 495 | CABC37941D328B4900722C65 /* Release */, 496 | ); 497 | defaultConfigurationIsVisible = 0; 498 | }; 499 | CABC37951D328B4900722C65 /* Build configuration list for PBXNativeTarget "SplashViewSampleTests" */ = { 500 | isa = XCConfigurationList; 501 | buildConfigurations = ( 502 | CABC37961D328B4900722C65 /* Debug */, 503 | CABC37971D328B4900722C65 /* Release */, 504 | ); 505 | defaultConfigurationIsVisible = 0; 506 | }; 507 | CABC37981D328B4900722C65 /* Build configuration list for PBXNativeTarget "SplashViewSampleUITests" */ = { 508 | isa = XCConfigurationList; 509 | buildConfigurations = ( 510 | CABC37991D328B4900722C65 /* Debug */, 511 | CABC379A1D328B4900722C65 /* Release */, 512 | ); 513 | defaultConfigurationIsVisible = 0; 514 | }; 515 | /* End XCConfigurationList section */ 516 | }; 517 | rootObject = CABC37621D328B4800722C65 /* Project object */; 518 | } 519 | -------------------------------------------------------------------------------- /SplashViewSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SplashViewSample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SplashViewSample 4 | // 5 | // Created by jkyeo on 16/7/10. 6 | // Copyright © 2016年 jkyeo. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // 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. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /SplashViewSample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /SplashViewSample/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 | -------------------------------------------------------------------------------- /SplashViewSample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /SplashViewSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | NSAppTransportSecurity 47 | 48 | NSAllowsArbitraryLoads 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /SplashViewSample/SplashView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SplashView.swift 3 | // aircleaner 4 | // 5 | // Created by Kooze on 16/7/7. 6 | // Copyright © 2016年 purisen. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SplashView: UIView { 12 | 13 | // const 14 | static let IMG_URL = "splash_img_url" 15 | static let ACT_URL = "splash_act_url" 16 | static let IMG_PATH = String(format: "%@/Documents/splash_image.jpg", NSHomeDirectory()) 17 | 18 | // in portrait mode 19 | let screenWidth = UIScreen.mainScreen().bounds.size.width 20 | let screenHeight = UIScreen.mainScreen().bounds.size.height 21 | let statusHeight = UIApplication.sharedApplication().statusBarFrame.height 22 | 23 | let buttonSize: CGFloat = 36.0 24 | let buttonMargin: CGFloat = 16.0 25 | 26 | var durationTime: Int = 6 { 27 | didSet { 28 | skipButton?.setTitle("跳过\n\(durationTime) s", forState: .Normal) 29 | } 30 | } 31 | 32 | // data 33 | var imageUrl: String? 34 | var actionUrl: String? 35 | var timer: NSTimer? 36 | 37 | var tapSplashImageBlock: ((actionUrl: String?) -> Void)? 38 | var splashViewDissmissBlock: ((initiativeDismiss: Bool) -> Void)? 39 | 40 | // views 41 | var imageView: UIImageView? 42 | var skipButton: UIButton? 43 | 44 | init() { 45 | super.init(frame: CGRectMake(0, 0, screenWidth, screenHeight)) 46 | initComponents() 47 | } 48 | 49 | required init?(coder aDecoder: NSCoder) { 50 | fatalError("init(coder:) has not been implemented") 51 | } 52 | 53 | // call this method at least in viewDidAppear func 54 | class func showSplashView(duration: Int = 6, 55 | defaultImage: UIImage?, 56 | tapSplashImageBlock: ((actionUrl: String?) -> Void)?, 57 | splashViewDismissBlock: ((initiativeDismiss: Bool) -> Void)?) { 58 | if isExistsSplashData() { 59 | let splashView = SplashView() 60 | splashView.tapSplashImageBlock = tapSplashImageBlock 61 | splashView.splashViewDissmissBlock = splashViewDismissBlock 62 | splashView.durationTime = duration 63 | UIApplication.sharedApplication().delegate?.window!!.addSubview(splashView) 64 | } else if let _defaultImage = defaultImage { 65 | let splashView = SplashView() 66 | splashView.tapSplashImageBlock = tapSplashImageBlock 67 | splashView.splashViewDissmissBlock = splashViewDismissBlock 68 | splashView.durationTime = duration 69 | splashView.imageView?.image = _defaultImage 70 | UIApplication.sharedApplication().delegate?.window!!.addSubview(splashView) 71 | } 72 | } 73 | 74 | class func simpleShowSplashView() { 75 | showSplashView(defaultImage: nil, tapSplashImageBlock: nil, splashViewDismissBlock: nil) 76 | } 77 | 78 | func initComponents() { 79 | // init data 80 | imageUrl = NSUserDefaults.standardUserDefaults().valueForKey(SplashView.IMG_URL) as? String 81 | actionUrl = NSUserDefaults.standardUserDefaults().valueForKey(SplashView.ACT_URL) as? String 82 | 83 | // initViews 84 | self.backgroundColor = UIColor.whiteColor() 85 | 86 | imageView = UIImageView(frame: CGRectMake(0, 0, screenWidth, screenHeight)) 87 | imageView?.userInteractionEnabled = true 88 | let recognize = UITapGestureRecognizer(target: self, action: #selector(tapImageAction)) 89 | imageView?.addGestureRecognizer(recognize) 90 | imageView?.image = UIImage(contentsOfFile: SplashView.IMG_PATH) 91 | self.addSubview(imageView!) 92 | 93 | skipButton = UIButton(frame: CGRectMake(screenWidth - buttonSize - buttonMargin, 94 | buttonMargin + statusHeight, buttonSize, buttonSize)) 95 | skipButton?.layer.cornerRadius = buttonSize / 2 96 | skipButton?.clipsToBounds = true 97 | skipButton?.backgroundColor = UIColor(red: 0.3, green: 0.3, blue: 0.3, alpha: 0.3) 98 | skipButton?.setTitleColor(UIColor.whiteColor(), forState: .Normal) 99 | skipButton?.titleLabel?.font = UIFont.systemFontOfSize(10) 100 | skipButton?.titleLabel?.textAlignment = .Center 101 | skipButton?.titleLabel?.numberOfLines = 2 102 | skipButton?.setTitle("跳过\n\(durationTime) s", forState: .Normal) 103 | skipButton?.addTarget(self, action: #selector(skipAction), forControlEvents: .TouchUpInside) 104 | self.addSubview(skipButton!) 105 | 106 | setupTimer() 107 | } 108 | 109 | func tapImageAction() { 110 | if let _tapSplashImageBlock = self.tapSplashImageBlock { 111 | self.skipAction() 112 | _tapSplashImageBlock(actionUrl: self.actionUrl) 113 | } 114 | } 115 | 116 | 117 | func skipAction() { 118 | dismissSplashView(true) 119 | } 120 | 121 | func setupTimer() { 122 | timer = NSTimer.scheduledTimerWithTimeInterval(1.0, 123 | target: self, 124 | selector: #selector(timerCycleAction), 125 | userInfo: nil, 126 | repeats: true) 127 | } 128 | 129 | func stopTimer() { 130 | timer?.invalidate() 131 | timer = nil 132 | } 133 | 134 | func timerCycleAction() { 135 | if 0 == durationTime { 136 | dismissSplashView(false) 137 | } else { 138 | durationTime -= 1 139 | } 140 | } 141 | 142 | func dismissSplashView(initiativeDismiss: Bool) { 143 | 144 | stopTimer() 145 | UIView.animateWithDuration(0.6, 146 | animations: { 147 | self.alpha = 0.0 148 | self.transform = CGAffineTransformMakeScale(1.5, 1.5) 149 | }, 150 | completion: {(finished) -> Void in 151 | self.removeFromSuperview() 152 | if let _splashViewDissmissBlock = self.splashViewDissmissBlock { 153 | _splashViewDissmissBlock(initiativeDismiss: initiativeDismiss) 154 | } 155 | }) 156 | } 157 | 158 | class func isExistsSplashData() -> Bool{ 159 | let latestImgUrl = NSUserDefaults.standardUserDefaults().valueForKey(IMG_URL) as? String 160 | let isFileExists = NSFileManager.defaultManager().fileExistsAtPath(IMG_PATH) 161 | 162 | return nil != latestImgUrl && isFileExists 163 | } 164 | 165 | class func updateSplashData(imgUrl: String?, actUrl: String?) { 166 | if nil == imgUrl { 167 | // no data 168 | return 169 | } 170 | 171 | NSUserDefaults.standardUserDefaults().setValue(imgUrl, forKey: IMG_URL) 172 | NSUserDefaults.standardUserDefaults().setValue(actUrl, forKey: ACT_URL) 173 | NSUserDefaults.standardUserDefaults().synchronize() 174 | 175 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), { 176 | let imageURL = NSURL(string: imgUrl!) 177 | if let _imageURL = imageURL { 178 | let data = NSData(contentsOfURL: _imageURL) 179 | if let _data = data { 180 | let image = UIImage(data: _data) 181 | if let _image = image { 182 | UIImagePNGRepresentation(_image)?.writeToFile(IMG_PATH, atomically: true) 183 | } 184 | } 185 | 186 | } 187 | }) 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /SplashViewSample/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // SplashViewSample 4 | // 5 | // Created by jkyeo on 16/7/10. 6 | // Copyright © 2016年 jkyeo. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | // Do any additional setup after loading the view, typically from a nib. 16 | 17 | SplashView.updateSplashData("http://ww2.sinaimg.cn/large/72f96cbagw1f5mxjtl6htj20g00sg0vn.jpg", actUrl: "http://jkyeo.com") 18 | } 19 | 20 | override func viewDidAppear(animated: Bool) { 21 | SplashView.showSplashView(defaultImage: UIImage(named: "default_img"), 22 | tapSplashImageBlock: {(actionUrl) -> Void in 23 | print("splash image taped, actionUrl optional: \(actionUrl)") 24 | }, 25 | splashViewDismissBlock: { (initiativeDismiss) in 26 | print("splash view dismissed, initiativeDismiss optional: \(initiativeDismiss)") 27 | }) 28 | } 29 | 30 | override func didReceiveMemoryWarning() { 31 | super.didReceiveMemoryWarning() 32 | // Dispose of any resources that can be recreated. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /SplashViewSample/default_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jkyeo/iOS-SplashView/5b6fd1e8187ce13125604b03fb275844fc8a7474/SplashViewSample/default_img.png -------------------------------------------------------------------------------- /SplashViewSampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /SplashViewSampleTests/SplashViewSampleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SplashViewSampleTests.swift 3 | // SplashViewSampleTests 4 | // 5 | // Created by jkyeo on 16/7/10. 6 | // Copyright © 2016年 jkyeo. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import SplashViewSample 11 | 12 | class SplashViewSampleTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /SplashViewSampleUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /SplashViewSampleUITests/SplashViewSampleUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SplashViewSampleUITests.swift 3 | // SplashViewSampleUITests 4 | // 5 | // Created by jkyeo on 16/7/10. 6 | // Copyright © 2016年 jkyeo. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class SplashViewSampleUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | XCUIApplication().launch() 22 | 23 | // 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. 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | func testExample() { 32 | // Use recording to get started writing UI tests. 33 | // Use XCTAssert and related functions to verify your tests produce the correct results. 34 | } 35 | 36 | } 37 | --------------------------------------------------------------------------------