├── README.md ├── ScrollBlurView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── ScrollBlurView.xccheckout │ └── xcuserdata │ │ └── Jason.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── Jason.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── ScrollBlurView.xcscheme │ └── xcschememanagement.plist ├── ScrollBlurView ├── AppDelegate.h ├── AppDelegate.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── ScrollBlurView-Info.plist ├── ScrollBlurView-Prefix.pch ├── ScrollBlurView.h ├── ScrollBlurView.m ├── UIColor+Extension.h ├── UIColor+Extension.m ├── ViewController.h ├── ViewController.m ├── anchor.png ├── en.lproj │ └── InfoPlist.strings └── main.m ├── ScrollBlurViewTests ├── ScrollBlurViewTests-Info.plist ├── ScrollBlurViewTests.m └── en.lproj │ └── InfoPlist.strings ├── demo.gif ├── effect1.png ├── effect2.png └── effect3.png /README.md: -------------------------------------------------------------------------------- 1 | introduction 2 | ======================= 3 | `ScrollBlurView` is a subclass of `UIView`.when scrolling,it can make part of the view behind it blurred. 4 | 5 | 6 | 7 | Effects 8 | ======================= 9 | ####GIF Image 10 | ScrollBlurView demo 11 | 12 | 13 | ####HD PNG Images 14 | ScrollBlurView demo 15 |
16 | ScrollBlurView demo 17 | 18 | ScrollBlurView demo 19 | 20 | -------------------------------------------------------------------------------- /ScrollBlurView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 963411841952820C00D09762 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 963411831952820C00D09762 /* Foundation.framework */; }; 11 | 963411861952820C00D09762 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 963411851952820C00D09762 /* CoreGraphics.framework */; }; 12 | 963411881952820C00D09762 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 963411871952820C00D09762 /* UIKit.framework */; }; 13 | 9634118E1952820C00D09762 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9634118C1952820C00D09762 /* InfoPlist.strings */; }; 14 | 963411901952820C00D09762 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9634118F1952820C00D09762 /* main.m */; }; 15 | 963411941952820C00D09762 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 963411931952820C00D09762 /* AppDelegate.m */; }; 16 | 963411961952820C00D09762 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 963411951952820C00D09762 /* Images.xcassets */; }; 17 | 9634119D1952820C00D09762 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9634119C1952820C00D09762 /* XCTest.framework */; }; 18 | 9634119E1952820C00D09762 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 963411831952820C00D09762 /* Foundation.framework */; }; 19 | 9634119F1952820C00D09762 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 963411871952820C00D09762 /* UIKit.framework */; }; 20 | 963411A71952820C00D09762 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 963411A51952820C00D09762 /* InfoPlist.strings */; }; 21 | 963411A91952820C00D09762 /* ScrollBlurViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 963411A81952820C00D09762 /* ScrollBlurViewTests.m */; }; 22 | 963411B41952823A00D09762 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 963411B31952823A00D09762 /* ViewController.m */; }; 23 | 963411B71952828300D09762 /* ScrollBlurView.m in Sources */ = {isa = PBXBuildFile; fileRef = 963411B61952828300D09762 /* ScrollBlurView.m */; }; 24 | 963411B9195295D000D09762 /* anchor.png in Resources */ = {isa = PBXBuildFile; fileRef = 963411B8195295D000D09762 /* anchor.png */; }; 25 | 963411BC195296FD00D09762 /* UIColor+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 963411BB195296FD00D09762 /* UIColor+Extension.m */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 963411A01952820C00D09762 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 963411781952820C00D09762 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 9634117F1952820C00D09762; 34 | remoteInfo = ScrollBlurView; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 963411801952820C00D09762 /* ScrollBlurView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ScrollBlurView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 963411831952820C00D09762 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 41 | 963411851952820C00D09762 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 42 | 963411871952820C00D09762 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 43 | 9634118B1952820C00D09762 /* ScrollBlurView-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ScrollBlurView-Info.plist"; sourceTree = ""; }; 44 | 9634118D1952820C00D09762 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 45 | 9634118F1952820C00D09762 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 46 | 963411911952820C00D09762 /* ScrollBlurView-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ScrollBlurView-Prefix.pch"; sourceTree = ""; }; 47 | 963411921952820C00D09762 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | 963411931952820C00D09762 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | 963411951952820C00D09762 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 50 | 9634119B1952820C00D09762 /* ScrollBlurViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ScrollBlurViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 9634119C1952820C00D09762 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 52 | 963411A41952820C00D09762 /* ScrollBlurViewTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ScrollBlurViewTests-Info.plist"; sourceTree = ""; }; 53 | 963411A61952820C00D09762 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 54 | 963411A81952820C00D09762 /* ScrollBlurViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScrollBlurViewTests.m; sourceTree = ""; }; 55 | 963411B21952823A00D09762 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 56 | 963411B31952823A00D09762 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 57 | 963411B51952828300D09762 /* ScrollBlurView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollBlurView.h; sourceTree = ""; }; 58 | 963411B61952828300D09762 /* ScrollBlurView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScrollBlurView.m; sourceTree = ""; }; 59 | 963411B8195295D000D09762 /* anchor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = anchor.png; sourceTree = ""; }; 60 | 963411BA195296FD00D09762 /* UIColor+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+Extension.h"; sourceTree = ""; }; 61 | 963411BB195296FD00D09762 /* UIColor+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Extension.m"; sourceTree = ""; }; 62 | /* End PBXFileReference section */ 63 | 64 | /* Begin PBXFrameworksBuildPhase section */ 65 | 9634117D1952820C00D09762 /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | 963411861952820C00D09762 /* CoreGraphics.framework in Frameworks */, 70 | 963411881952820C00D09762 /* UIKit.framework in Frameworks */, 71 | 963411841952820C00D09762 /* Foundation.framework in Frameworks */, 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | 963411981952820C00D09762 /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | 9634119D1952820C00D09762 /* XCTest.framework in Frameworks */, 80 | 9634119F1952820C00D09762 /* UIKit.framework in Frameworks */, 81 | 9634119E1952820C00D09762 /* Foundation.framework in Frameworks */, 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | /* End PBXFrameworksBuildPhase section */ 86 | 87 | /* Begin PBXGroup section */ 88 | 963411771952820C00D09762 = { 89 | isa = PBXGroup; 90 | children = ( 91 | 963411891952820C00D09762 /* ScrollBlurView */, 92 | 963411A21952820C00D09762 /* ScrollBlurViewTests */, 93 | 963411821952820C00D09762 /* Frameworks */, 94 | 963411811952820C00D09762 /* Products */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | 963411811952820C00D09762 /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 963411801952820C00D09762 /* ScrollBlurView.app */, 102 | 9634119B1952820C00D09762 /* ScrollBlurViewTests.xctest */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | 963411821952820C00D09762 /* Frameworks */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 963411831952820C00D09762 /* Foundation.framework */, 111 | 963411851952820C00D09762 /* CoreGraphics.framework */, 112 | 963411871952820C00D09762 /* UIKit.framework */, 113 | 9634119C1952820C00D09762 /* XCTest.framework */, 114 | ); 115 | name = Frameworks; 116 | sourceTree = ""; 117 | }; 118 | 963411891952820C00D09762 /* ScrollBlurView */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 963411B8195295D000D09762 /* anchor.png */, 122 | 963411921952820C00D09762 /* AppDelegate.h */, 123 | 963411931952820C00D09762 /* AppDelegate.m */, 124 | 963411951952820C00D09762 /* Images.xcassets */, 125 | 9634118A1952820C00D09762 /* Supporting Files */, 126 | 963411B21952823A00D09762 /* ViewController.h */, 127 | 963411B31952823A00D09762 /* ViewController.m */, 128 | 963411B51952828300D09762 /* ScrollBlurView.h */, 129 | 963411B61952828300D09762 /* ScrollBlurView.m */, 130 | 963411BA195296FD00D09762 /* UIColor+Extension.h */, 131 | 963411BB195296FD00D09762 /* UIColor+Extension.m */, 132 | ); 133 | path = ScrollBlurView; 134 | sourceTree = ""; 135 | }; 136 | 9634118A1952820C00D09762 /* Supporting Files */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 9634118B1952820C00D09762 /* ScrollBlurView-Info.plist */, 140 | 9634118C1952820C00D09762 /* InfoPlist.strings */, 141 | 9634118F1952820C00D09762 /* main.m */, 142 | 963411911952820C00D09762 /* ScrollBlurView-Prefix.pch */, 143 | ); 144 | name = "Supporting Files"; 145 | sourceTree = ""; 146 | }; 147 | 963411A21952820C00D09762 /* ScrollBlurViewTests */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 963411A81952820C00D09762 /* ScrollBlurViewTests.m */, 151 | 963411A31952820C00D09762 /* Supporting Files */, 152 | ); 153 | path = ScrollBlurViewTests; 154 | sourceTree = ""; 155 | }; 156 | 963411A31952820C00D09762 /* Supporting Files */ = { 157 | isa = PBXGroup; 158 | children = ( 159 | 963411A41952820C00D09762 /* ScrollBlurViewTests-Info.plist */, 160 | 963411A51952820C00D09762 /* InfoPlist.strings */, 161 | ); 162 | name = "Supporting Files"; 163 | sourceTree = ""; 164 | }; 165 | /* End PBXGroup section */ 166 | 167 | /* Begin PBXNativeTarget section */ 168 | 9634117F1952820C00D09762 /* ScrollBlurView */ = { 169 | isa = PBXNativeTarget; 170 | buildConfigurationList = 963411AC1952820C00D09762 /* Build configuration list for PBXNativeTarget "ScrollBlurView" */; 171 | buildPhases = ( 172 | 9634117C1952820C00D09762 /* Sources */, 173 | 9634117D1952820C00D09762 /* Frameworks */, 174 | 9634117E1952820C00D09762 /* Resources */, 175 | ); 176 | buildRules = ( 177 | ); 178 | dependencies = ( 179 | ); 180 | name = ScrollBlurView; 181 | productName = ScrollBlurView; 182 | productReference = 963411801952820C00D09762 /* ScrollBlurView.app */; 183 | productType = "com.apple.product-type.application"; 184 | }; 185 | 9634119A1952820C00D09762 /* ScrollBlurViewTests */ = { 186 | isa = PBXNativeTarget; 187 | buildConfigurationList = 963411AF1952820C00D09762 /* Build configuration list for PBXNativeTarget "ScrollBlurViewTests" */; 188 | buildPhases = ( 189 | 963411971952820C00D09762 /* Sources */, 190 | 963411981952820C00D09762 /* Frameworks */, 191 | 963411991952820C00D09762 /* Resources */, 192 | ); 193 | buildRules = ( 194 | ); 195 | dependencies = ( 196 | 963411A11952820C00D09762 /* PBXTargetDependency */, 197 | ); 198 | name = ScrollBlurViewTests; 199 | productName = ScrollBlurViewTests; 200 | productReference = 9634119B1952820C00D09762 /* ScrollBlurViewTests.xctest */; 201 | productType = "com.apple.product-type.bundle.unit-test"; 202 | }; 203 | /* End PBXNativeTarget section */ 204 | 205 | /* Begin PBXProject section */ 206 | 963411781952820C00D09762 /* Project object */ = { 207 | isa = PBXProject; 208 | attributes = { 209 | LastUpgradeCheck = 0510; 210 | ORGANIZATIONNAME = jason; 211 | TargetAttributes = { 212 | 9634119A1952820C00D09762 = { 213 | TestTargetID = 9634117F1952820C00D09762; 214 | }; 215 | }; 216 | }; 217 | buildConfigurationList = 9634117B1952820C00D09762 /* Build configuration list for PBXProject "ScrollBlurView" */; 218 | compatibilityVersion = "Xcode 3.2"; 219 | developmentRegion = English; 220 | hasScannedForEncodings = 0; 221 | knownRegions = ( 222 | en, 223 | ); 224 | mainGroup = 963411771952820C00D09762; 225 | productRefGroup = 963411811952820C00D09762 /* Products */; 226 | projectDirPath = ""; 227 | projectRoot = ""; 228 | targets = ( 229 | 9634117F1952820C00D09762 /* ScrollBlurView */, 230 | 9634119A1952820C00D09762 /* ScrollBlurViewTests */, 231 | ); 232 | }; 233 | /* End PBXProject section */ 234 | 235 | /* Begin PBXResourcesBuildPhase section */ 236 | 9634117E1952820C00D09762 /* Resources */ = { 237 | isa = PBXResourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | 9634118E1952820C00D09762 /* InfoPlist.strings in Resources */, 241 | 963411B9195295D000D09762 /* anchor.png in Resources */, 242 | 963411961952820C00D09762 /* Images.xcassets in Resources */, 243 | ); 244 | runOnlyForDeploymentPostprocessing = 0; 245 | }; 246 | 963411991952820C00D09762 /* Resources */ = { 247 | isa = PBXResourcesBuildPhase; 248 | buildActionMask = 2147483647; 249 | files = ( 250 | 963411A71952820C00D09762 /* InfoPlist.strings in Resources */, 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | /* End PBXResourcesBuildPhase section */ 255 | 256 | /* Begin PBXSourcesBuildPhase section */ 257 | 9634117C1952820C00D09762 /* Sources */ = { 258 | isa = PBXSourcesBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | 963411B41952823A00D09762 /* ViewController.m in Sources */, 262 | 963411941952820C00D09762 /* AppDelegate.m in Sources */, 263 | 963411B71952828300D09762 /* ScrollBlurView.m in Sources */, 264 | 963411901952820C00D09762 /* main.m in Sources */, 265 | 963411BC195296FD00D09762 /* UIColor+Extension.m in Sources */, 266 | ); 267 | runOnlyForDeploymentPostprocessing = 0; 268 | }; 269 | 963411971952820C00D09762 /* Sources */ = { 270 | isa = PBXSourcesBuildPhase; 271 | buildActionMask = 2147483647; 272 | files = ( 273 | 963411A91952820C00D09762 /* ScrollBlurViewTests.m in Sources */, 274 | ); 275 | runOnlyForDeploymentPostprocessing = 0; 276 | }; 277 | /* End PBXSourcesBuildPhase section */ 278 | 279 | /* Begin PBXTargetDependency section */ 280 | 963411A11952820C00D09762 /* PBXTargetDependency */ = { 281 | isa = PBXTargetDependency; 282 | target = 9634117F1952820C00D09762 /* ScrollBlurView */; 283 | targetProxy = 963411A01952820C00D09762 /* PBXContainerItemProxy */; 284 | }; 285 | /* End PBXTargetDependency section */ 286 | 287 | /* Begin PBXVariantGroup section */ 288 | 9634118C1952820C00D09762 /* InfoPlist.strings */ = { 289 | isa = PBXVariantGroup; 290 | children = ( 291 | 9634118D1952820C00D09762 /* en */, 292 | ); 293 | name = InfoPlist.strings; 294 | sourceTree = ""; 295 | }; 296 | 963411A51952820C00D09762 /* InfoPlist.strings */ = { 297 | isa = PBXVariantGroup; 298 | children = ( 299 | 963411A61952820C00D09762 /* en */, 300 | ); 301 | name = InfoPlist.strings; 302 | sourceTree = ""; 303 | }; 304 | /* End PBXVariantGroup section */ 305 | 306 | /* Begin XCBuildConfiguration section */ 307 | 963411AA1952820C00D09762 /* Debug */ = { 308 | isa = XCBuildConfiguration; 309 | buildSettings = { 310 | ALWAYS_SEARCH_USER_PATHS = NO; 311 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 312 | CLANG_CXX_LIBRARY = "libc++"; 313 | CLANG_ENABLE_MODULES = YES; 314 | CLANG_ENABLE_OBJC_ARC = YES; 315 | CLANG_WARN_BOOL_CONVERSION = YES; 316 | CLANG_WARN_CONSTANT_CONVERSION = YES; 317 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 318 | CLANG_WARN_EMPTY_BODY = YES; 319 | CLANG_WARN_ENUM_CONVERSION = YES; 320 | CLANG_WARN_INT_CONVERSION = YES; 321 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 322 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 323 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 324 | COPY_PHASE_STRIP = NO; 325 | GCC_C_LANGUAGE_STANDARD = gnu99; 326 | GCC_DYNAMIC_NO_PIC = NO; 327 | GCC_OPTIMIZATION_LEVEL = 0; 328 | GCC_PREPROCESSOR_DEFINITIONS = ( 329 | "DEBUG=1", 330 | "$(inherited)", 331 | ); 332 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 333 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 334 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 335 | GCC_WARN_UNDECLARED_SELECTOR = YES; 336 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 337 | GCC_WARN_UNUSED_FUNCTION = YES; 338 | GCC_WARN_UNUSED_VARIABLE = YES; 339 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 340 | ONLY_ACTIVE_ARCH = YES; 341 | SDKROOT = iphoneos; 342 | }; 343 | name = Debug; 344 | }; 345 | 963411AB1952820C00D09762 /* Release */ = { 346 | isa = XCBuildConfiguration; 347 | buildSettings = { 348 | ALWAYS_SEARCH_USER_PATHS = NO; 349 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 350 | CLANG_CXX_LIBRARY = "libc++"; 351 | CLANG_ENABLE_MODULES = YES; 352 | CLANG_ENABLE_OBJC_ARC = YES; 353 | CLANG_WARN_BOOL_CONVERSION = YES; 354 | CLANG_WARN_CONSTANT_CONVERSION = YES; 355 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 356 | CLANG_WARN_EMPTY_BODY = YES; 357 | CLANG_WARN_ENUM_CONVERSION = YES; 358 | CLANG_WARN_INT_CONVERSION = YES; 359 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 360 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 362 | COPY_PHASE_STRIP = YES; 363 | ENABLE_NS_ASSERTIONS = NO; 364 | GCC_C_LANGUAGE_STANDARD = gnu99; 365 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 366 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 367 | GCC_WARN_UNDECLARED_SELECTOR = YES; 368 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 369 | GCC_WARN_UNUSED_FUNCTION = YES; 370 | GCC_WARN_UNUSED_VARIABLE = YES; 371 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 372 | SDKROOT = iphoneos; 373 | VALIDATE_PRODUCT = YES; 374 | }; 375 | name = Release; 376 | }; 377 | 963411AD1952820C00D09762 /* Debug */ = { 378 | isa = XCBuildConfiguration; 379 | buildSettings = { 380 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 381 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 382 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 383 | GCC_PREFIX_HEADER = "ScrollBlurView/ScrollBlurView-Prefix.pch"; 384 | INFOPLIST_FILE = "ScrollBlurView/ScrollBlurView-Info.plist"; 385 | PRODUCT_NAME = "$(TARGET_NAME)"; 386 | WRAPPER_EXTENSION = app; 387 | }; 388 | name = Debug; 389 | }; 390 | 963411AE1952820C00D09762 /* Release */ = { 391 | isa = XCBuildConfiguration; 392 | buildSettings = { 393 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 394 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 395 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 396 | GCC_PREFIX_HEADER = "ScrollBlurView/ScrollBlurView-Prefix.pch"; 397 | INFOPLIST_FILE = "ScrollBlurView/ScrollBlurView-Info.plist"; 398 | PRODUCT_NAME = "$(TARGET_NAME)"; 399 | WRAPPER_EXTENSION = app; 400 | }; 401 | name = Release; 402 | }; 403 | 963411B01952820C00D09762 /* Debug */ = { 404 | isa = XCBuildConfiguration; 405 | buildSettings = { 406 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/ScrollBlurView.app/ScrollBlurView"; 407 | FRAMEWORK_SEARCH_PATHS = ( 408 | "$(SDKROOT)/Developer/Library/Frameworks", 409 | "$(inherited)", 410 | "$(DEVELOPER_FRAMEWORKS_DIR)", 411 | ); 412 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 413 | GCC_PREFIX_HEADER = "ScrollBlurView/ScrollBlurView-Prefix.pch"; 414 | GCC_PREPROCESSOR_DEFINITIONS = ( 415 | "DEBUG=1", 416 | "$(inherited)", 417 | ); 418 | INFOPLIST_FILE = "ScrollBlurViewTests/ScrollBlurViewTests-Info.plist"; 419 | PRODUCT_NAME = "$(TARGET_NAME)"; 420 | TEST_HOST = "$(BUNDLE_LOADER)"; 421 | WRAPPER_EXTENSION = xctest; 422 | }; 423 | name = Debug; 424 | }; 425 | 963411B11952820C00D09762 /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/ScrollBlurView.app/ScrollBlurView"; 429 | FRAMEWORK_SEARCH_PATHS = ( 430 | "$(SDKROOT)/Developer/Library/Frameworks", 431 | "$(inherited)", 432 | "$(DEVELOPER_FRAMEWORKS_DIR)", 433 | ); 434 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 435 | GCC_PREFIX_HEADER = "ScrollBlurView/ScrollBlurView-Prefix.pch"; 436 | INFOPLIST_FILE = "ScrollBlurViewTests/ScrollBlurViewTests-Info.plist"; 437 | PRODUCT_NAME = "$(TARGET_NAME)"; 438 | TEST_HOST = "$(BUNDLE_LOADER)"; 439 | WRAPPER_EXTENSION = xctest; 440 | }; 441 | name = Release; 442 | }; 443 | /* End XCBuildConfiguration section */ 444 | 445 | /* Begin XCConfigurationList section */ 446 | 9634117B1952820C00D09762 /* Build configuration list for PBXProject "ScrollBlurView" */ = { 447 | isa = XCConfigurationList; 448 | buildConfigurations = ( 449 | 963411AA1952820C00D09762 /* Debug */, 450 | 963411AB1952820C00D09762 /* Release */, 451 | ); 452 | defaultConfigurationIsVisible = 0; 453 | defaultConfigurationName = Release; 454 | }; 455 | 963411AC1952820C00D09762 /* Build configuration list for PBXNativeTarget "ScrollBlurView" */ = { 456 | isa = XCConfigurationList; 457 | buildConfigurations = ( 458 | 963411AD1952820C00D09762 /* Debug */, 459 | 963411AE1952820C00D09762 /* Release */, 460 | ); 461 | defaultConfigurationIsVisible = 0; 462 | }; 463 | 963411AF1952820C00D09762 /* Build configuration list for PBXNativeTarget "ScrollBlurViewTests" */ = { 464 | isa = XCConfigurationList; 465 | buildConfigurations = ( 466 | 963411B01952820C00D09762 /* Debug */, 467 | 963411B11952820C00D09762 /* Release */, 468 | ); 469 | defaultConfigurationIsVisible = 0; 470 | }; 471 | /* End XCConfigurationList section */ 472 | }; 473 | rootObject = 963411781952820C00D09762 /* Project object */; 474 | } 475 | -------------------------------------------------------------------------------- /ScrollBlurView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ScrollBlurView.xcodeproj/project.xcworkspace/xcshareddata/ScrollBlurView.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | EB73E3D9-3720-4E0D-A5F5-07556CB144F8 9 | IDESourceControlProjectName 10 | ScrollBlurView 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 6FD786B6-FFF7-448E-A83D-6862AC672780 14 | https://github.com/JasonZengJ/ScrollBlurView.git 15 | 16 | IDESourceControlProjectPath 17 | ScrollBlurView.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 6FD786B6-FFF7-448E-A83D-6862AC672780 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/JasonZengJ/ScrollBlurView.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | 6FD786B6-FFF7-448E-A83D-6862AC672780 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 6FD786B6-FFF7-448E-A83D-6862AC672780 36 | IDESourceControlWCCName 37 | ScrollBlurView 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ScrollBlurView.xcodeproj/project.xcworkspace/xcuserdata/Jason.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonZengJ/ScrollBlurView/b60ce2ab310ba290a1bcdc55b34a1b60c2f102a3/ScrollBlurView.xcodeproj/project.xcworkspace/xcuserdata/Jason.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ScrollBlurView.xcodeproj/xcuserdata/Jason.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /ScrollBlurView.xcodeproj/xcuserdata/Jason.xcuserdatad/xcschemes/ScrollBlurView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /ScrollBlurView.xcodeproj/xcuserdata/Jason.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ScrollBlurView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9634117F1952820C00D09762 16 | 17 | primary 18 | 19 | 20 | 9634119A1952820C00D09762 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ScrollBlurView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ScrollBlurView 4 | // 5 | // Created by jason on 6/19/14. 6 | // Copyright (c) 2014 jason. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ScrollBlurView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ScrollBlurView 4 | // 5 | // Created by jason on 6/19/14. 6 | // Copyright (c) 2014 jason. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @implementation AppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 17 | // Override point for customization after application launch. 18 | self.window.rootViewController = [[ViewController alloc] initWithNibName:nil bundle:nil]; 19 | [self.window makeKeyAndVisible]; 20 | 21 | return YES; 22 | } 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application 25 | { 26 | // 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. 27 | // 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. 28 | } 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application 31 | { 32 | // 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. 33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | } 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application 37 | { 38 | // 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. 39 | } 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application 42 | { 43 | // 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. 44 | } 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application 47 | { 48 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /ScrollBlurView/Images.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" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /ScrollBlurView/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /ScrollBlurView/ScrollBlurView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDisplayName 6 | ${PRODUCT_NAME} 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.Jason.${PRODUCT_NAME:rfc1034identifier} 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.0 23 | LSRequiresIPhoneOS 24 | 25 | UISupportedInterfaceOrientations 26 | 27 | UIInterfaceOrientationPortrait 28 | UIInterfaceOrientationLandscapeLeft 29 | UIInterfaceOrientationLandscapeRight 30 | 31 | UIViewControllerBasedStatusBarAppearance 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /ScrollBlurView/ScrollBlurView-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /ScrollBlurView/ScrollBlurView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ScrollBlurView.h 3 | // ScrollBlurView 4 | // 5 | // Created by jason on 6/19/14. 6 | // Copyright (c) 2014 jason. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ScrollBlurView : UIView 12 | 13 | - (void)animateUpWithDuration:(NSTimeInterval)duration; 14 | - (void)addBlurView:(UIView*)view withRadius:(CGFloat)radius; 15 | @end 16 | -------------------------------------------------------------------------------- /ScrollBlurView/ScrollBlurView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ScrollBlurView.m 3 | // ScrollBlurView 4 | // 5 | // Created by jason on 6/19/14. 6 | // Copyright (c) 2014 jason. All rights reserved. 7 | // 8 | 9 | #import "ScrollBlurView.h" 10 | #import "UIColor+Extension.h" 11 | #import 12 | 13 | #define MiddleYPosition 223 14 | 15 | 16 | @interface ScrollBlurView () 17 | 18 | @property(nonatomic) CGPoint beginPosition; 19 | @property(nonatomic) CGPoint stopPostion; 20 | @property(nonatomic) CGFloat yPosition; 21 | @property(nonatomic) CGFloat pi; 22 | @property(nonatomic) CGFloat duration; 23 | @property(nonatomic) CGFloat swipeCondition; 24 | @property(nonatomic) BOOL isAnimationReset; 25 | @property(nonatomic) UIButton *swipeDownBtn; 26 | @property(nonatomic) UIView *blurView; 27 | @property(nonatomic) UIImageView *blurImageView; 28 | @property(nonatomic) CGFloat viewHeight; 29 | @property(nonatomic) CGFloat viewWidth; 30 | 31 | @end 32 | 33 | @implementation ScrollBlurView 34 | 35 | - (id)initWithFrame:(CGRect)frame 36 | { 37 | self = [super initWithFrame:frame]; 38 | if (self) { 39 | // Init 40 | self.backgroundColor = [UIColor colorWithHex:0x212121 alpha:0.7]; 41 | 42 | _viewHeight = frame.size.height; 43 | _viewWidth = frame.size.width; 44 | _swipeDownBtn = [[UIButton alloc] initWithFrame:CGRectMake(140, 5, 40, 40) ]; 45 | 46 | [_swipeDownBtn setBackgroundImage:[UIImage imageNamed:@"anchor.png"] forState:UIControlStateNormal]; 47 | [_swipeDownBtn addTarget:self action:@selector(swipeInit:) forControlEvents:UIControlEventTouchDown]; 48 | 49 | UIPanGestureRecognizer *panGR = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(swipeView:) ]; 50 | panGR.minimumNumberOfTouches = 1; 51 | panGR.maximumNumberOfTouches = 1; 52 | 53 | [_swipeDownBtn addGestureRecognizer:panGR]; 54 | 55 | [self addSubview:_swipeDownBtn]; 56 | 57 | } 58 | return self; 59 | } 60 | 61 | - (void)addBlurView:(UIView*)view withRadius:(CGFloat)radius 62 | { 63 | UIImage *captureImage = [self captureView:view]; 64 | UIImage *blurImage = [self blurImage:captureImage WithRadius:radius]; 65 | _blurImageView = [[UIImageView alloc] initWithImage:blurImage]; 66 | _blurImageView.frame = CGRectMake(0, -_viewHeight,_viewWidth , _viewHeight); 67 | _blurView = [[UIView alloc] initWithFrame:CGRectMake(0, _viewHeight , _viewWidth,0 )]; 68 | _blurView.clipsToBounds = YES; 69 | [_blurView addSubview:_blurImageView]; 70 | [self.superview addSubview:_blurView]; 71 | [self.superview bringSubviewToFront:self]; 72 | } 73 | 74 | - (UIImage *)blurImage:(UIImage *)image WithRadius:(CGFloat)blurRadius 75 | { 76 | if ((blurRadius < 0.0f) || (blurRadius > 1.0f)) { 77 | blurRadius = 0.5f; 78 | } 79 | int boxSize = (int)(blurRadius * 100); 80 | boxSize -= (boxSize % 2) + 1; 81 | 82 | CGImageRef rawImage = image.CGImage; 83 | vImage_Buffer inBuffer, outBuffer; 84 | vImage_Error error; 85 | void *pixelBuffer; 86 | 87 | CGDataProviderRef inProvider = CGImageGetDataProvider(rawImage); 88 | CFDataRef inBitmapData = CGDataProviderCopyData(inProvider); 89 | 90 | inBuffer.width = CGImageGetWidth(rawImage); 91 | inBuffer.height = CGImageGetHeight(rawImage); 92 | inBuffer.rowBytes = CGImageGetBytesPerRow(rawImage); 93 | inBuffer.data = (void *)CFDataGetBytePtr(inBitmapData); 94 | pixelBuffer = malloc(CGImageGetBytesPerRow(rawImage) * CGImageGetHeight(rawImage)); 95 | 96 | outBuffer.data = pixelBuffer; 97 | outBuffer.width = CGImageGetWidth(rawImage); 98 | outBuffer.height = CGImageGetHeight(rawImage); 99 | outBuffer.rowBytes = CGImageGetBytesPerRow(rawImage); 100 | 101 | error = vImageBoxConvolve_ARGB8888(&inBuffer, &outBuffer, NULL, 0, 0, boxSize, boxSize, NULL, kvImageEdgeExtend); 102 | 103 | if (error) { 104 | NSLog(@"error for convolution %ld",error); 105 | } 106 | 107 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 108 | CGContextRef ctx = CGBitmapContextCreate(outBuffer.data, outBuffer.width, outBuffer.height, 8, outBuffer.rowBytes, colorSpace, CGImageGetBitmapInfo(image.CGImage)); 109 | CGImageRef imageRef = CGBitmapContextCreateImage(ctx); 110 | UIImage *returnImage = [UIImage imageWithCGImage:imageRef]; 111 | 112 | CGContextRelease(ctx); 113 | CGColorSpaceRelease(colorSpace); 114 | free(pixelBuffer); 115 | CFRelease(inBitmapData); 116 | CGImageRelease(imageRef); 117 | 118 | return returnImage; 119 | } 120 | 121 | - (UIImage *)captureView:(UIView *)view 122 | { 123 | UIGraphicsBeginImageContext([UIScreen mainScreen].bounds.size); 124 | CGContextRef ctx = UIGraphicsGetCurrentContext(); 125 | CGContextFillRect(ctx, [UIScreen mainScreen].bounds); 126 | [view.layer renderInContext:ctx]; 127 | UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); 128 | UIGraphicsEndImageContext(); 129 | 130 | return newImage; 131 | } 132 | 133 | - (void)animateDownWithDuration:(NSTimeInterval)duration 134 | { 135 | 136 | [UIView animateWithDuration:duration animations:^(){ 137 | _blurView.frame = CGRectMake(0, _viewHeight, _viewWidth, _viewHeight); 138 | _blurImageView.frame = CGRectMake(0, - _viewHeight, _viewWidth, _viewHeight); 139 | self.frame = CGRectMake(0, _viewHeight, _viewWidth, _viewHeight); 140 | }]; 141 | 142 | } 143 | 144 | - (void)animateUpWithDuration:(NSTimeInterval)duration 145 | { 146 | 147 | [UIView animateWithDuration:duration animations:^(){ 148 | _blurView.frame = CGRectMake(0, 20, _viewWidth, _viewHeight); 149 | _blurImageView.frame = CGRectMake(0, - 20, _viewWidth, _viewHeight); 150 | self.frame = CGRectMake(0, 20, _viewWidth, _viewHeight); 151 | }]; 152 | 153 | } 154 | 155 | - (void)swipeView:(UIPanGestureRecognizer*)sender{ 156 | 157 | CGPoint currentPosition = [sender locationInView:self.superview]; 158 | if(currentPosition.y == _beginPosition.y) return; 159 | CGFloat currentPI = (currentPosition.x - _beginPosition.x)/currentPosition.y; 160 | NSLog(@"rotate:%f",currentPI); 161 | 162 | if (-1.30 < currentPI && currentPI < 1.30) { 163 | _swipeDownBtn.transform = CGAffineTransformMakeRotation(- currentPI); 164 | _pi = currentPI; 165 | } 166 | if (currentPosition.y > _yPosition) { 167 | CGFloat y = currentPosition.y - _beginPosition.y; 168 | self.frame = CGRectMake(0, y, _viewWidth, _viewHeight); 169 | _blurView.frame = CGRectMake(0, y, _viewWidth, _viewHeight); 170 | _blurImageView.frame = CGRectMake(0, -y, _viewWidth, _viewHeight); 171 | 172 | } 173 | if (sender.state == UIGestureRecognizerStateBegan) { 174 | _duration = 0.4; 175 | } 176 | if (sender.state == UIGestureRecognizerStateEnded) { 177 | 178 | _stopPostion = self.frame.origin; 179 | 180 | [self animation:_duration target:self completion:@selector(swipeAnimate:) animation:^(){ 181 | _swipeDownBtn.transform = CGAffineTransformMakeRotation(_pi); 182 | }]; 183 | 184 | if(_stopPostion.y > MiddleYPosition){ 185 | [self animateDownWithDuration:0.4]; 186 | }else{ 187 | [self animateUpWithDuration:0.4]; 188 | } 189 | } 190 | NSLog(@"Begin Position:(%f,%f) Current Position:(%f,%f)",_beginPosition.x,_beginPosition.y,currentPosition.x,currentPosition.y); 191 | 192 | } 193 | 194 | - (void)swipeInit:(UIButton *)sender{ 195 | 196 | _beginPosition = CGPointMake(_swipeDownBtn.frame.origin.x +30, _swipeDownBtn.frame.origin.y + 43 ); 197 | _yPosition = _beginPosition.y + 20; 198 | _duration = 0.4; 199 | _isAnimationReset = YES; 200 | NSLog(@"begin duration:%f",_duration); 201 | 202 | } 203 | 204 | - (void)swipeAnimate:(id)sender{ 205 | 206 | NSLog(@"pi:%f,duration:%f",_pi,_duration); 207 | _swipeCondition = _pi * 100; 208 | if ((-1.0 < _swipeCondition && _swipeCondition < 1.0 ) || _isAnimationReset) { 209 | return; 210 | } 211 | _pi *= -0.8; 212 | _duration *= 0.9; 213 | [self animation:_duration target:self completion:@selector(swipeAnimate:) animation:^(){ 214 | _swipeDownBtn.transform = CGAffineTransformMakeRotation(_pi); 215 | }]; 216 | 217 | 218 | } 219 | 220 | - (void)animation:(NSTimeInterval)duration target:(id)target completion:(SEL)action animation:(void (^)())animationBlock 221 | { 222 | _isAnimationReset = NO; 223 | [UIView beginAnimations:nil context:nil]; 224 | [UIView setAnimationDuration:duration]; 225 | [UIView setAnimationDelegate:target]; 226 | [UIView setAnimationCurve:UIViewAnimationCurveEaseOut]; 227 | animationBlock(); 228 | [UIView setAnimationDidStopSelector:action]; 229 | [UIView commitAnimations]; 230 | 231 | } 232 | 233 | /* 234 | // Only override drawRect: if you perform custom drawing. 235 | // An empty implementation adversely affects performance during animation. 236 | - (void)drawRect:(CGRect)rect 237 | { 238 | // Drawing code 239 | } 240 | */ 241 | 242 | @end 243 | -------------------------------------------------------------------------------- /ScrollBlurView/UIColor+Extension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+view.h 3 | // ScrollBlurView 4 | // 5 | // Created by jason on 6/19/14. 6 | // Copyright (c) 2014 jason. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIColor (Extension) 12 | 13 | + (UIColor*)colorWithHex:(uint)hex alpha:(CGFloat)alpha; 14 | @end 15 | -------------------------------------------------------------------------------- /ScrollBlurView/UIColor+Extension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+view.m 3 | // ScrollBlurView 4 | // 5 | // Created by jason on 6/19/14. 6 | // Copyright (c) 2014 jason. All rights reserved. 7 | // 8 | 9 | #import "UIColor+Extension.h" 10 | 11 | @implementation UIColor (Extension) 12 | 13 | + (UIColor *)colorWithHex:(uint)hex alpha:(CGFloat)alpha 14 | { 15 | int red,green,blue; 16 | 17 | blue = (hex & 0x0000FF); 18 | green = ((hex & 0x00FF00) >> 8); 19 | red = ((hex & 0xFF0000) >> 16); 20 | 21 | return [UIColor colorWithRed:red / 255.0 green:green / 255.0 blue:blue / 255.0 alpha:alpha]; 22 | 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /ScrollBlurView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ScrollBlurView 4 | // 5 | // Created by jason on 6/19/14. 6 | // Copyright (c) 2014 jason. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ScrollBlurView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ScrollBlurView 4 | // 5 | // Created by jason on 6/19/14. 6 | // Copyright (c) 2014 jason. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "ScrollBlurView.h" 11 | 12 | #define ScreenHeight [UIScreen mainScreen].bounds.size.height 13 | #define ScreenWidth [UIScreen mainScreen].bounds.size.width 14 | 15 | @interface ViewController () 16 | 17 | @property NSArray *color; 18 | @property UIButton *blurViewButton; 19 | @property ScrollBlurView *scrollBlurView; 20 | 21 | @end 22 | 23 | @implementation ViewController 24 | 25 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 26 | { 27 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 28 | if (self) { 29 | // Custom initialization 30 | self.view.backgroundColor = [UIColor whiteColor]; 31 | 32 | _color = @[[UIColor grayColor],[UIColor greenColor],[UIColor blueColor],[UIColor purpleColor],[UIColor cyanColor],[UIColor yellowColor]]; 33 | _blurViewButton = [[UIButton alloc] initWithFrame:CGRectMake(100, 450, 100, 50)]; 34 | _blurViewButton.backgroundColor = [UIColor colorWithRed:0.1 green:0.7 blue:0.9 alpha:1.0]; 35 | [_blurViewButton setTitle:@"blurView" forState:UIControlStateNormal]; 36 | [_blurViewButton addTarget:self action:@selector(swipeView:) forControlEvents:UIControlEventTouchUpInside]; 37 | 38 | [self.view addSubview:_blurViewButton]; 39 | [self.view addSubview:[self addDotButtonWithFrame:CGRectMake(100, 100, 50,50)]]; 40 | [self.view addSubview:[self addDotButtonWithFrame:CGRectMake(30, 30, 50,50)]]; 41 | [self.view addSubview:[self addDotButtonWithFrame:CGRectMake(150, 150, 50, 50)]]; 42 | [self.view addSubview:[self addDotButtonWithFrame:CGRectMake(100, 250, 50, 50)]]; 43 | [self.view addSubview:[self addDotButtonWithFrame:CGRectMake(200, 250, 50, 50)]]; 44 | [self.view addSubview:[self addDotButtonWithFrame:CGRectMake(160, 350, 50, 50)]]; 45 | 46 | 47 | _scrollBlurView = [[ScrollBlurView alloc] initWithFrame:CGRectMake(0, ScreenHeight, ScreenWidth, ScreenHeight)]; 48 | 49 | // the method addBlurView of ScrollBlurView must invocated behind addSubview 50 | [self.view addSubview:_scrollBlurView]; 51 | [_scrollBlurView addBlurView:self.view withRadius:0.4]; 52 | } 53 | return self; 54 | } 55 | 56 | - (void) swipeView:(id)sender{ 57 | 58 | [_scrollBlurView animateUpWithDuration:0.5]; 59 | 60 | } 61 | 62 | - (UIButton*)addDotButtonWithFrame:(CGRect)frame 63 | { 64 | 65 | UIButton *button = [[UIButton alloc] initWithFrame:frame]; 66 | button.layer.cornerRadius = 25; 67 | button.backgroundColor = [_color objectAtIndex:random() % _color.count]; 68 | 69 | return button; 70 | 71 | } 72 | 73 | - (void)viewDidLoad 74 | { 75 | [super viewDidLoad]; 76 | // Do any additional setup after loading the view. 77 | } 78 | 79 | - (void)didReceiveMemoryWarning 80 | { 81 | [super didReceiveMemoryWarning]; 82 | // Dispose of any resources that can be recreated. 83 | } 84 | 85 | /* 86 | #pragma mark - Navigation 87 | 88 | // In a storyboard-based application, you will often want to do a little preparation before navigation 89 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 90 | { 91 | // Get the new view controller using [segue destinationViewController]. 92 | // Pass the selected object to the new view controller. 93 | } 94 | */ 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /ScrollBlurView/anchor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonZengJ/ScrollBlurView/b60ce2ab310ba290a1bcdc55b34a1b60c2f102a3/ScrollBlurView/anchor.png -------------------------------------------------------------------------------- /ScrollBlurView/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /ScrollBlurView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ScrollBlurView 4 | // 5 | // Created by jason on 6/19/14. 6 | // Copyright (c) 2014 jason. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ScrollBlurViewTests/ScrollBlurViewTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.Jason.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ScrollBlurViewTests/ScrollBlurViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ScrollBlurViewTests.m 3 | // ScrollBlurViewTests 4 | // 5 | // Created by jason on 6/19/14. 6 | // Copyright (c) 2014 jason. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ScrollBlurViewTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ScrollBlurViewTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /ScrollBlurViewTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonZengJ/ScrollBlurView/b60ce2ab310ba290a1bcdc55b34a1b60c2f102a3/demo.gif -------------------------------------------------------------------------------- /effect1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonZengJ/ScrollBlurView/b60ce2ab310ba290a1bcdc55b34a1b60c2f102a3/effect1.png -------------------------------------------------------------------------------- /effect2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonZengJ/ScrollBlurView/b60ce2ab310ba290a1bcdc55b34a1b60c2f102a3/effect2.png -------------------------------------------------------------------------------- /effect3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonZengJ/ScrollBlurView/b60ce2ab310ba290a1bcdc55b34a1b60c2f102a3/effect3.png --------------------------------------------------------------------------------