├── .gitignore ├── LICENSE ├── README.md ├── SSFadingScrollView.png ├── SSFadingScrollView.podspec ├── SSFadingScrollView.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ ├── SSFadingScrollView.xcscheme │ └── SSFadingScrollViewDemo.xcscheme ├── SSFadingScrollView ├── Info.plist ├── SSFadingScrollView.h └── SSFadingScrollView.m └── SSFadingScrollViewDemo ├── Images.xcassets ├── Contents.json ├── coffee-1.imageset │ ├── Contents.json │ └── coffee-1.png ├── coffee-2.imageset │ ├── Contents.json │ └── coffee-2.png └── coffee-3.imageset │ ├── Contents.json │ └── coffee-3.png ├── LaunchScreen.storyboard ├── SSAppDelegate.h ├── SSAppDelegate.m ├── SSFadingScrollViewDemo-Info.plist ├── en.lproj ├── InfoPlist.strings └── MainStoryboard.storyboard └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Mac OS X 2 | *.DS_Store 3 | 4 | # Xcode 5 | *.pbxuser 6 | *.mode1v3 7 | *.mode2v3 8 | *.perspectivev3 9 | *.xcuserstate 10 | project.xcworkspace/ 11 | xcuserdata/ 12 | DerivedData 13 | 14 | # Generated files 15 | *.o 16 | *.pyc 17 | 18 | #Python modules 19 | MANIFEST 20 | dist/ 21 | build/ 22 | 23 | # Backup files 24 | *~.nib 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Stephanie Sharp 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #SSFadingScrollView 2 | 3 | A UIScrollView subclass that fades the leading and/or trailing edges of a scroll view to transparent. It animates the gradient in and out based on the current content offset, and uses a mask to fade the scroll view content without also fading the scroll bars. 4 | 5 | ![SSFadingScrollView screenshots](SSFadingScrollView.png) 6 | 7 | ##Features 8 | 9 | - [x] Fade top and/or bottom of vertical scroll view 10 | - [x] Fade left and/or right of horizontal scroll view 11 | - [x] Animated fade in and out (based on content offset) with customizable duration 12 | - [x] Adjustable gradient size 13 | - [x] Scroll bars don't fade out with the scroll view content 14 | - [x] IBInspectable properties allow you to set up your fading scroll view entirely in Interface Builder. (See the demo project for an example.) 15 | 16 | ##Properties 17 | 18 | #####fadeLeadingEdge 19 | 20 | Fade leading edge of fade axis. Default is YES. 21 | 22 | #####fadeTrailingEdge 23 | 24 | Fade trailing edge of fade axis. Default is YES. 25 | 26 | #####fadeSize 27 | 28 | Size of gradient. Default is 30. 29 | 30 | #####fadeDuration 31 | 32 | Duration of fade in & out. Default is 0.3 seconds. 33 | 34 | #####maskScrollBars 35 | 36 | Default is YES. Scroll bars are masked so they don't fade with the scroll view content. Set to NO to fade out the scroll bars along with the content. 37 | 38 | ##Installation 39 | 40 | ###CocoaPods 41 | 42 | To install via CocoaPods, add to your podfile: 43 | 44 | pod 'SSFadingScrollView', '~> 1.1' 45 | 46 | ##Acknowledgements 47 | 48 | With thanks to: 49 | 50 | - [MaximKeegan](https://gist.github.com/MaximKeegan)/[FadeScrollView](https://gist.github.com/MaximKeegan/2478842) 51 | - [kgn](https://gist.github.com/kgn)/[SNFadeScrollView](https://gist.github.com/kgn/3180607) 52 | 53 | Photos in the demo project were sourced from [Unsplash](https://unsplash.com/). 54 | 55 | ##License 56 | 57 | SSFadingScrollView is released under the MIT license. See LICENSE for details. 58 | -------------------------------------------------------------------------------- /SSFadingScrollView.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stephsharp/SSFadingScrollView/366188d2b7f7961338f6c5fc917ab3ed087016fd/SSFadingScrollView.png -------------------------------------------------------------------------------- /SSFadingScrollView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "SSFadingScrollView" 3 | s.version = "1.1.0" 4 | s.summary = "A UIScrollView subclass that fades the leading and/or trailing edges of a scroll view to transparent" 5 | s.homepage = "https://github.com/stephsharp/SSFadingScrollView/" 6 | s.license = { :type => "MIT", :file => "LICENSE" } 7 | s.author = "Stephanie Sharp" 8 | s.platform = :ios, "8.0" 9 | s.source = { :git => "https://github.com/stephsharp/SSFadingScrollView.git", :tag => "v#{s.version}" } 10 | s.source_files = "SSFadingScrollView" 11 | s.public_header_files = [ "SSFadingScrollView/SSFadingScrollView.h" ] 12 | s.framework = 'QuartzCore' 13 | s.requires_arc = true 14 | end 15 | -------------------------------------------------------------------------------- /SSFadingScrollView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 47; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 82630F651B63A4EE003B4CCA /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 82630F641B63A4EE003B4CCA /* Images.xcassets */; }; 11 | 82B3A6901C031A13000024C3 /* SSFadingScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B3A68F1C031A13000024C3 /* SSFadingScrollView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 12 | 82B3A6941C031A13000024C3 /* SSFadingScrollView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 82B3A68D1C031A13000024C3 /* SSFadingScrollView.framework */; }; 13 | 82B3A6951C031A13000024C3 /* SSFadingScrollView.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 82B3A68D1C031A13000024C3 /* SSFadingScrollView.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 82B3A69B1C031AE4000024C3 /* SSFadingScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 82B3A69A1C031AE4000024C3 /* SSFadingScrollView.m */; }; 15 | 82B3A69F1C031FB6000024C3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 82B3A69E1C031FB6000024C3 /* LaunchScreen.storyboard */; }; 16 | 970FDD7517A7A512008DC2FB /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 970FDD2A17A7A4DC008DC2FB /* UIKit.framework */; }; 17 | 970FDD7617A7A512008DC2FB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 970FDD2C17A7A4DC008DC2FB /* Foundation.framework */; }; 18 | 970FDD7717A7A512008DC2FB /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 970FDD2E17A7A4DC008DC2FB /* CoreGraphics.framework */; }; 19 | 970FDD7D17A7A512008DC2FB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 970FDD7B17A7A512008DC2FB /* InfoPlist.strings */; }; 20 | 970FDD7F17A7A512008DC2FB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 970FDD7E17A7A512008DC2FB /* main.m */; }; 21 | 970FDD8317A7A512008DC2FB /* SSAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 970FDD8217A7A512008DC2FB /* SSAppDelegate.m */; }; 22 | 970FDD8C17A7A512008DC2FB /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 970FDD8A17A7A512008DC2FB /* MainStoryboard.storyboard */; }; 23 | 970FDD9D17A7A5C6008DC2FB /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 970FDD9B17A7A5B9008DC2FB /* QuartzCore.framework */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | 82B3A6921C031A13000024C3 /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 970FDD1F17A7A4DC008DC2FB /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = 82B3A68C1C031A13000024C3; 32 | remoteInfo = SSFadingScrollView; 33 | }; 34 | /* End PBXContainerItemProxy section */ 35 | 36 | /* Begin PBXCopyFilesBuildPhase section */ 37 | 82B3A6991C031A13000024C3 /* Embed Frameworks */ = { 38 | isa = PBXCopyFilesBuildPhase; 39 | buildActionMask = 2147483647; 40 | dstPath = ""; 41 | dstSubfolderSpec = 10; 42 | files = ( 43 | 82B3A6951C031A13000024C3 /* SSFadingScrollView.framework in Embed Frameworks */, 44 | ); 45 | name = "Embed Frameworks"; 46 | runOnlyForDeploymentPostprocessing = 0; 47 | }; 48 | /* End PBXCopyFilesBuildPhase section */ 49 | 50 | /* Begin PBXFileReference section */ 51 | 82630F641B63A4EE003B4CCA /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 52 | 82B3A68D1C031A13000024C3 /* SSFadingScrollView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SSFadingScrollView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 82B3A68F1C031A13000024C3 /* SSFadingScrollView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SSFadingScrollView.h; sourceTree = ""; }; 54 | 82B3A6911C031A13000024C3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | 82B3A69A1C031AE4000024C3 /* SSFadingScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSFadingScrollView.m; sourceTree = ""; }; 56 | 82B3A69E1C031FB6000024C3 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; 57 | 970FDD2A17A7A4DC008DC2FB /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 58 | 970FDD2C17A7A4DC008DC2FB /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 59 | 970FDD2E17A7A4DC008DC2FB /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 60 | 970FDD7417A7A512008DC2FB /* SSFadingScrollViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SSFadingScrollViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 61 | 970FDD7A17A7A512008DC2FB /* SSFadingScrollViewDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SSFadingScrollViewDemo-Info.plist"; sourceTree = ""; }; 62 | 970FDD7C17A7A512008DC2FB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 63 | 970FDD7E17A7A512008DC2FB /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 64 | 970FDD8117A7A512008DC2FB /* SSAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SSAppDelegate.h; sourceTree = ""; }; 65 | 970FDD8217A7A512008DC2FB /* SSAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SSAppDelegate.m; sourceTree = ""; }; 66 | 970FDD8B17A7A512008DC2FB /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard.storyboard; sourceTree = ""; }; 67 | 970FDD9B17A7A5B9008DC2FB /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 68 | /* End PBXFileReference section */ 69 | 70 | /* Begin PBXFrameworksBuildPhase section */ 71 | 82B3A6891C031A13000024C3 /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | 970FDD7117A7A512008DC2FB /* Frameworks */ = { 79 | isa = PBXFrameworksBuildPhase; 80 | buildActionMask = 2147483647; 81 | files = ( 82 | 970FDD9D17A7A5C6008DC2FB /* QuartzCore.framework in Frameworks */, 83 | 970FDD7517A7A512008DC2FB /* UIKit.framework in Frameworks */, 84 | 970FDD7617A7A512008DC2FB /* Foundation.framework in Frameworks */, 85 | 82B3A6941C031A13000024C3 /* SSFadingScrollView.framework in Frameworks */, 86 | 970FDD7717A7A512008DC2FB /* CoreGraphics.framework in Frameworks */, 87 | ); 88 | runOnlyForDeploymentPostprocessing = 0; 89 | }; 90 | /* End PBXFrameworksBuildPhase section */ 91 | 92 | /* Begin PBXGroup section */ 93 | 82B3A68E1C031A13000024C3 /* SSFadingScrollView */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 82B3A68F1C031A13000024C3 /* SSFadingScrollView.h */, 97 | 82B3A69A1C031AE4000024C3 /* SSFadingScrollView.m */, 98 | 82B3A6911C031A13000024C3 /* Info.plist */, 99 | ); 100 | path = SSFadingScrollView; 101 | sourceTree = ""; 102 | }; 103 | 970FDD1E17A7A4DC008DC2FB = { 104 | isa = PBXGroup; 105 | children = ( 106 | 82B3A68E1C031A13000024C3 /* SSFadingScrollView */, 107 | 970FDD7817A7A512008DC2FB /* SSFadingScrollViewDemo */, 108 | 970FDD2917A7A4DC008DC2FB /* Frameworks */, 109 | 970FDD2817A7A4DC008DC2FB /* Products */, 110 | ); 111 | sourceTree = ""; 112 | }; 113 | 970FDD2817A7A4DC008DC2FB /* Products */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 970FDD7417A7A512008DC2FB /* SSFadingScrollViewDemo.app */, 117 | 82B3A68D1C031A13000024C3 /* SSFadingScrollView.framework */, 118 | ); 119 | name = Products; 120 | sourceTree = ""; 121 | }; 122 | 970FDD2917A7A4DC008DC2FB /* Frameworks */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 970FDD2A17A7A4DC008DC2FB /* UIKit.framework */, 126 | 970FDD2C17A7A4DC008DC2FB /* Foundation.framework */, 127 | 970FDD2E17A7A4DC008DC2FB /* CoreGraphics.framework */, 128 | 970FDD9B17A7A5B9008DC2FB /* QuartzCore.framework */, 129 | ); 130 | name = Frameworks; 131 | sourceTree = ""; 132 | }; 133 | 970FDD7817A7A512008DC2FB /* SSFadingScrollViewDemo */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 970FDD8117A7A512008DC2FB /* SSAppDelegate.h */, 137 | 970FDD8217A7A512008DC2FB /* SSAppDelegate.m */, 138 | 970FDD8A17A7A512008DC2FB /* MainStoryboard.storyboard */, 139 | 82B3A69E1C031FB6000024C3 /* LaunchScreen.storyboard */, 140 | 82630F641B63A4EE003B4CCA /* Images.xcassets */, 141 | 970FDD7917A7A512008DC2FB /* Supporting Files */, 142 | ); 143 | path = SSFadingScrollViewDemo; 144 | sourceTree = ""; 145 | }; 146 | 970FDD7917A7A512008DC2FB /* Supporting Files */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | 970FDD7A17A7A512008DC2FB /* SSFadingScrollViewDemo-Info.plist */, 150 | 970FDD7B17A7A512008DC2FB /* InfoPlist.strings */, 151 | 970FDD7E17A7A512008DC2FB /* main.m */, 152 | ); 153 | name = "Supporting Files"; 154 | sourceTree = ""; 155 | }; 156 | /* End PBXGroup section */ 157 | 158 | /* Begin PBXHeadersBuildPhase section */ 159 | 82B3A68A1C031A13000024C3 /* Headers */ = { 160 | isa = PBXHeadersBuildPhase; 161 | buildActionMask = 2147483647; 162 | files = ( 163 | 82B3A6901C031A13000024C3 /* SSFadingScrollView.h in Headers */, 164 | ); 165 | runOnlyForDeploymentPostprocessing = 0; 166 | }; 167 | /* End PBXHeadersBuildPhase section */ 168 | 169 | /* Begin PBXNativeTarget section */ 170 | 82B3A68C1C031A13000024C3 /* SSFadingScrollView */ = { 171 | isa = PBXNativeTarget; 172 | buildConfigurationList = 82B3A6981C031A13000024C3 /* Build configuration list for PBXNativeTarget "SSFadingScrollView" */; 173 | buildPhases = ( 174 | 82B3A6881C031A13000024C3 /* Sources */, 175 | 82B3A6891C031A13000024C3 /* Frameworks */, 176 | 82B3A68A1C031A13000024C3 /* Headers */, 177 | 82B3A68B1C031A13000024C3 /* Resources */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | ); 183 | name = SSFadingScrollView; 184 | productName = SSFadingScrollView; 185 | productReference = 82B3A68D1C031A13000024C3 /* SSFadingScrollView.framework */; 186 | productType = "com.apple.product-type.framework"; 187 | }; 188 | 970FDD7317A7A512008DC2FB /* SSFadingScrollViewDemo */ = { 189 | isa = PBXNativeTarget; 190 | buildConfigurationList = 970FDD9017A7A512008DC2FB /* Build configuration list for PBXNativeTarget "SSFadingScrollViewDemo" */; 191 | buildPhases = ( 192 | 970FDD7017A7A512008DC2FB /* Sources */, 193 | 970FDD7117A7A512008DC2FB /* Frameworks */, 194 | 970FDD7217A7A512008DC2FB /* Resources */, 195 | 82B3A6991C031A13000024C3 /* Embed Frameworks */, 196 | ); 197 | buildRules = ( 198 | ); 199 | dependencies = ( 200 | 82B3A6931C031A13000024C3 /* PBXTargetDependency */, 201 | ); 202 | name = SSFadingScrollViewDemo; 203 | productName = FadingScrollViewDemo; 204 | productReference = 970FDD7417A7A512008DC2FB /* SSFadingScrollViewDemo.app */; 205 | productType = "com.apple.product-type.application"; 206 | }; 207 | /* End PBXNativeTarget section */ 208 | 209 | /* Begin PBXProject section */ 210 | 970FDD1F17A7A4DC008DC2FB /* Project object */ = { 211 | isa = PBXProject; 212 | attributes = { 213 | CLASSPREFIX = SS; 214 | LastUpgradeCheck = 0710; 215 | ORGANIZATIONNAME = "Stephanie Sharp"; 216 | TargetAttributes = { 217 | 82B3A68C1C031A13000024C3 = { 218 | CreatedOnToolsVersion = 7.1; 219 | }; 220 | }; 221 | }; 222 | buildConfigurationList = 970FDD2217A7A4DC008DC2FB /* Build configuration list for PBXProject "SSFadingScrollView" */; 223 | compatibilityVersion = "Xcode 6.3"; 224 | developmentRegion = English; 225 | hasScannedForEncodings = 0; 226 | knownRegions = ( 227 | en, 228 | ); 229 | mainGroup = 970FDD1E17A7A4DC008DC2FB; 230 | productRefGroup = 970FDD2817A7A4DC008DC2FB /* Products */; 231 | projectDirPath = ""; 232 | projectRoot = ""; 233 | targets = ( 234 | 970FDD7317A7A512008DC2FB /* SSFadingScrollViewDemo */, 235 | 82B3A68C1C031A13000024C3 /* SSFadingScrollView */, 236 | ); 237 | }; 238 | /* End PBXProject section */ 239 | 240 | /* Begin PBXResourcesBuildPhase section */ 241 | 82B3A68B1C031A13000024C3 /* Resources */ = { 242 | isa = PBXResourcesBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | 970FDD7217A7A512008DC2FB /* Resources */ = { 249 | isa = PBXResourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | 970FDD7D17A7A512008DC2FB /* InfoPlist.strings in Resources */, 253 | 82B3A69F1C031FB6000024C3 /* LaunchScreen.storyboard in Resources */, 254 | 82630F651B63A4EE003B4CCA /* Images.xcassets in Resources */, 255 | 970FDD8C17A7A512008DC2FB /* MainStoryboard.storyboard in Resources */, 256 | ); 257 | runOnlyForDeploymentPostprocessing = 0; 258 | }; 259 | /* End PBXResourcesBuildPhase section */ 260 | 261 | /* Begin PBXSourcesBuildPhase section */ 262 | 82B3A6881C031A13000024C3 /* Sources */ = { 263 | isa = PBXSourcesBuildPhase; 264 | buildActionMask = 2147483647; 265 | files = ( 266 | 82B3A69B1C031AE4000024C3 /* SSFadingScrollView.m in Sources */, 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | }; 270 | 970FDD7017A7A512008DC2FB /* Sources */ = { 271 | isa = PBXSourcesBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | 970FDD7F17A7A512008DC2FB /* main.m in Sources */, 275 | 970FDD8317A7A512008DC2FB /* SSAppDelegate.m in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | /* End PBXSourcesBuildPhase section */ 280 | 281 | /* Begin PBXTargetDependency section */ 282 | 82B3A6931C031A13000024C3 /* PBXTargetDependency */ = { 283 | isa = PBXTargetDependency; 284 | target = 82B3A68C1C031A13000024C3 /* SSFadingScrollView */; 285 | targetProxy = 82B3A6921C031A13000024C3 /* PBXContainerItemProxy */; 286 | }; 287 | /* End PBXTargetDependency section */ 288 | 289 | /* Begin PBXVariantGroup section */ 290 | 970FDD7B17A7A512008DC2FB /* InfoPlist.strings */ = { 291 | isa = PBXVariantGroup; 292 | children = ( 293 | 970FDD7C17A7A512008DC2FB /* en */, 294 | ); 295 | name = InfoPlist.strings; 296 | sourceTree = ""; 297 | }; 298 | 970FDD8A17A7A512008DC2FB /* MainStoryboard.storyboard */ = { 299 | isa = PBXVariantGroup; 300 | children = ( 301 | 970FDD8B17A7A512008DC2FB /* en */, 302 | ); 303 | name = MainStoryboard.storyboard; 304 | sourceTree = ""; 305 | }; 306 | /* End PBXVariantGroup section */ 307 | 308 | /* Begin XCBuildConfiguration section */ 309 | 82B3A6961C031A13000024C3 /* Debug */ = { 310 | isa = XCBuildConfiguration; 311 | buildSettings = { 312 | CLANG_ENABLE_MODULES = YES; 313 | CLANG_WARN_BOOL_CONVERSION = YES; 314 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 315 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 316 | CLANG_WARN_UNREACHABLE_CODE = YES; 317 | CURRENT_PROJECT_VERSION = 1; 318 | DEBUG_INFORMATION_FORMAT = dwarf; 319 | DEFINES_MODULE = YES; 320 | DYLIB_COMPATIBILITY_VERSION = 1; 321 | DYLIB_CURRENT_VERSION = 1; 322 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 323 | ENABLE_STRICT_OBJC_MSGSEND = YES; 324 | GCC_NO_COMMON_BLOCKS = YES; 325 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 326 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 327 | GCC_WARN_UNDECLARED_SELECTOR = YES; 328 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 329 | GCC_WARN_UNUSED_FUNCTION = YES; 330 | INFOPLIST_FILE = SSFadingScrollView/Info.plist; 331 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 332 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 333 | MTL_ENABLE_DEBUG_INFO = YES; 334 | PRODUCT_BUNDLE_IDENTIFIER = com.ssharp.SSFadingScrollView; 335 | PRODUCT_NAME = SSFadingScrollView; 336 | SKIP_INSTALL = YES; 337 | TARGETED_DEVICE_FAMILY = "1,2"; 338 | VERSIONING_SYSTEM = "apple-generic"; 339 | VERSION_INFO_PREFIX = ""; 340 | }; 341 | name = Debug; 342 | }; 343 | 82B3A6971C031A13000024C3 /* Release */ = { 344 | isa = XCBuildConfiguration; 345 | buildSettings = { 346 | CLANG_ENABLE_MODULES = YES; 347 | CLANG_WARN_BOOL_CONVERSION = YES; 348 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 349 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 350 | CLANG_WARN_UNREACHABLE_CODE = YES; 351 | COPY_PHASE_STRIP = NO; 352 | CURRENT_PROJECT_VERSION = 1; 353 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 354 | DEFINES_MODULE = YES; 355 | DYLIB_COMPATIBILITY_VERSION = 1; 356 | DYLIB_CURRENT_VERSION = 1; 357 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 358 | ENABLE_NS_ASSERTIONS = NO; 359 | ENABLE_STRICT_OBJC_MSGSEND = YES; 360 | GCC_NO_COMMON_BLOCKS = YES; 361 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 362 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 363 | GCC_WARN_UNDECLARED_SELECTOR = YES; 364 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 365 | GCC_WARN_UNUSED_FUNCTION = YES; 366 | INFOPLIST_FILE = SSFadingScrollView/Info.plist; 367 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 368 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 369 | MTL_ENABLE_DEBUG_INFO = NO; 370 | PRODUCT_BUNDLE_IDENTIFIER = com.ssharp.SSFadingScrollView; 371 | PRODUCT_NAME = SSFadingScrollView; 372 | SKIP_INSTALL = YES; 373 | TARGETED_DEVICE_FAMILY = "1,2"; 374 | VERSIONING_SYSTEM = "apple-generic"; 375 | VERSION_INFO_PREFIX = ""; 376 | }; 377 | name = Release; 378 | }; 379 | 970FDD4817A7A4DD008DC2FB /* Debug */ = { 380 | isa = XCBuildConfiguration; 381 | buildSettings = { 382 | ALWAYS_SEARCH_USER_PATHS = NO; 383 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 384 | CLANG_CXX_LIBRARY = "libc++"; 385 | CLANG_ENABLE_OBJC_ARC = YES; 386 | CLANG_WARN_CONSTANT_CONVERSION = YES; 387 | CLANG_WARN_EMPTY_BODY = YES; 388 | CLANG_WARN_ENUM_CONVERSION = YES; 389 | CLANG_WARN_INT_CONVERSION = YES; 390 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 391 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 392 | COPY_PHASE_STRIP = NO; 393 | ENABLE_TESTABILITY = YES; 394 | GCC_C_LANGUAGE_STANDARD = gnu99; 395 | GCC_DYNAMIC_NO_PIC = NO; 396 | GCC_OPTIMIZATION_LEVEL = 0; 397 | GCC_PREPROCESSOR_DEFINITIONS = ( 398 | "DEBUG=1", 399 | "$(inherited)", 400 | ); 401 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 402 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 403 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 404 | GCC_WARN_UNUSED_VARIABLE = YES; 405 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 406 | ONLY_ACTIVE_ARCH = YES; 407 | SDKROOT = iphoneos; 408 | }; 409 | name = Debug; 410 | }; 411 | 970FDD4917A7A4DD008DC2FB /* Release */ = { 412 | isa = XCBuildConfiguration; 413 | buildSettings = { 414 | ALWAYS_SEARCH_USER_PATHS = NO; 415 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 416 | CLANG_CXX_LIBRARY = "libc++"; 417 | CLANG_ENABLE_OBJC_ARC = YES; 418 | CLANG_WARN_CONSTANT_CONVERSION = YES; 419 | CLANG_WARN_EMPTY_BODY = YES; 420 | CLANG_WARN_ENUM_CONVERSION = YES; 421 | CLANG_WARN_INT_CONVERSION = YES; 422 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 423 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 424 | COPY_PHASE_STRIP = YES; 425 | GCC_C_LANGUAGE_STANDARD = gnu99; 426 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 427 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 428 | GCC_WARN_UNUSED_VARIABLE = YES; 429 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 430 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 431 | SDKROOT = iphoneos; 432 | VALIDATE_PRODUCT = YES; 433 | }; 434 | name = Release; 435 | }; 436 | 970FDD9117A7A512008DC2FB /* Debug */ = { 437 | isa = XCBuildConfiguration; 438 | buildSettings = { 439 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 440 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 441 | INFOPLIST_FILE = "$(SRCROOT)/SSFadingScrollViewDemo/SSFadingScrollViewDemo-Info.plist"; 442 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 443 | PRODUCT_BUNDLE_IDENTIFIER = "com.ss.$(PRODUCT_NAME:rfc1034identifier)"; 444 | PRODUCT_NAME = SSFadingScrollViewDemo; 445 | WRAPPER_EXTENSION = app; 446 | }; 447 | name = Debug; 448 | }; 449 | 970FDD9217A7A512008DC2FB /* Release */ = { 450 | isa = XCBuildConfiguration; 451 | buildSettings = { 452 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 453 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 454 | INFOPLIST_FILE = "$(SRCROOT)/SSFadingScrollViewDemo/SSFadingScrollViewDemo-Info.plist"; 455 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 456 | PRODUCT_BUNDLE_IDENTIFIER = "com.ss.$(PRODUCT_NAME:rfc1034identifier)"; 457 | PRODUCT_NAME = SSFadingScrollViewDemo; 458 | WRAPPER_EXTENSION = app; 459 | }; 460 | name = Release; 461 | }; 462 | /* End XCBuildConfiguration section */ 463 | 464 | /* Begin XCConfigurationList section */ 465 | 82B3A6981C031A13000024C3 /* Build configuration list for PBXNativeTarget "SSFadingScrollView" */ = { 466 | isa = XCConfigurationList; 467 | buildConfigurations = ( 468 | 82B3A6961C031A13000024C3 /* Debug */, 469 | 82B3A6971C031A13000024C3 /* Release */, 470 | ); 471 | defaultConfigurationIsVisible = 0; 472 | defaultConfigurationName = Release; 473 | }; 474 | 970FDD2217A7A4DC008DC2FB /* Build configuration list for PBXProject "SSFadingScrollView" */ = { 475 | isa = XCConfigurationList; 476 | buildConfigurations = ( 477 | 970FDD4817A7A4DD008DC2FB /* Debug */, 478 | 970FDD4917A7A4DD008DC2FB /* Release */, 479 | ); 480 | defaultConfigurationIsVisible = 0; 481 | defaultConfigurationName = Release; 482 | }; 483 | 970FDD9017A7A512008DC2FB /* Build configuration list for PBXNativeTarget "SSFadingScrollViewDemo" */ = { 484 | isa = XCConfigurationList; 485 | buildConfigurations = ( 486 | 970FDD9117A7A512008DC2FB /* Debug */, 487 | 970FDD9217A7A512008DC2FB /* Release */, 488 | ); 489 | defaultConfigurationIsVisible = 0; 490 | defaultConfigurationName = Release; 491 | }; 492 | /* End XCConfigurationList section */ 493 | }; 494 | rootObject = 970FDD1F17A7A4DC008DC2FB /* Project object */; 495 | } 496 | -------------------------------------------------------------------------------- /SSFadingScrollView.xcodeproj/xcshareddata/xcschemes/SSFadingScrollView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /SSFadingScrollView.xcodeproj/xcshareddata/xcschemes/SSFadingScrollViewDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /SSFadingScrollView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /SSFadingScrollView/SSFadingScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSFadingScrollView.h 3 | // Created by Stephanie Sharp on 1/06/13. 4 | // 5 | 6 | #import 7 | 8 | //! Project version number for SSFadingScrollView. 9 | FOUNDATION_EXPORT double SSFadingScrollViewVersionNumber; 10 | 11 | //! Project version string for SSFadingScrollView. 12 | FOUNDATION_EXPORT const unsigned char SSFadingScrollViewVersionString[]; 13 | 14 | typedef NS_ENUM(NSUInteger, SSScrollViewFadeAxis) { 15 | SSScrollViewFadeAxisVertical = 0, 16 | SSScrollViewFadeAxisHorizontal = 1, 17 | }; 18 | 19 | typedef NS_ENUM(NSUInteger, FadeEdges) { 20 | FadeEdgesTopAndBottom __attribute__((deprecated("Use the fadeLeadingEdge and fadeTrailingEdge properties instead."))), 21 | FadeEdgesTop __attribute__((deprecated("Use the fadeLeadingEdge property instead."))), 22 | FadeEdgesBottom __attribute__((deprecated("Use the fadeTrailingEdge property instead."))), 23 | }; 24 | 25 | /** 26 | * This scrollview subclass is meant to only scroll in one direction (horizontal or vertical). 27 | * On the chosen axis, either or both the leading and trailing edges can be faded. 28 | */ 29 | @interface SSFadingScrollView : UIScrollView 30 | 31 | /** 32 | * Designated initializer. 33 | */ 34 | - (instancetype)initWithFadeSize:(CGFloat)fadeSize axis:(SSScrollViewFadeAxis)fadeAxis; 35 | 36 | /** 37 | * Initializer that fades the top and bottom of the scroll view. 38 | */ 39 | - (instancetype)initWithFadeSize:(CGFloat)fadeSize; 40 | 41 | /** 42 | * Initializer that fades the top and bottom of the scroll view with default fade height. 43 | */ 44 | - (instancetype)init; 45 | 46 | #if TARGET_INTERFACE_BUILDER 47 | @property (nonatomic) IBInspectable NSUInteger fadeAxis; 48 | #else 49 | @property (nonatomic) SSScrollViewFadeAxis fadeAxis; 50 | #endif 51 | 52 | /** 53 | * Fade leading edge of fade axis. Default is YES. 54 | */ 55 | @property (nonatomic) IBInspectable BOOL fadeLeadingEdge; 56 | 57 | /** 58 | * Fade trailing edge of fade axis. Default is YES. 59 | */ 60 | @property (nonatomic) IBInspectable BOOL fadeTrailingEdge; 61 | 62 | /** 63 | * Size of gradient. Default is 30. 64 | */ 65 | @property (nonatomic) IBInspectable CGFloat fadeSize; 66 | 67 | /** 68 | * Duration of fade in & out. Default is 0.3 seconds. 69 | */ 70 | @property (nonatomic) IBInspectable double fadeDuration; 71 | 72 | /** 73 | * Default is YES. Scroll bars are masked so they don't fade with the scroll view content. 74 | * Set to NO to fade out the scroll bars along with the content. 75 | */ 76 | @property (nonatomic) IBInspectable BOOL maskScrollBars; 77 | 78 | #pragma mark - Deprecated 79 | 80 | /** 81 | * Deprecated initializer. 82 | */ 83 | - (instancetype)initWithFadeHeight:(CGFloat)fadeHeight edges:(FadeEdges)fadeEdges __attribute__((deprecated("Use initWithFadeSize: and the fadeLeadingEdge/fadeTrailingEdge properties instead."))); 84 | 85 | /** 86 | * Initializer that fades the top and bottom of the scroll view. 87 | */ 88 | - (instancetype)initWithFadeHeight:(CGFloat)fadeHeight __attribute__((deprecated("Use initWithFadeSize: instead."))); 89 | 90 | /** 91 | * Fade top of scroll view. Default is YES. 92 | */ 93 | @property (nonatomic) BOOL fadeTop __attribute__((deprecated("Use the fadeLeadingEdge property instead."))); 94 | 95 | /** 96 | * Fade bottom of scroll view. Default is YES. 97 | */ 98 | @property (nonatomic) BOOL fadeBottom __attribute__((deprecated("Use the fadeTrailingEdge property instead."))); 99 | 100 | /** 101 | * Height of gradient. Default is 30. 102 | */ 103 | @property (nonatomic) CGFloat fadeHeight __attribute__((deprecated("Use the fadeSize property instead."))); 104 | 105 | @end 106 | -------------------------------------------------------------------------------- /SSFadingScrollView/SSFadingScrollView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSFadingScrollView.m 3 | // Created by Stephanie Sharp on 1/06/13. 4 | // 5 | 6 | #import "SSFadingScrollView.h" 7 | #import 8 | 9 | static CGFloat const SSDefaultFadeSize = 30.0; 10 | static CFTimeInterval const SSDefaultFadeDuration = 0.3; 11 | static void *SSContext = &SSContext; 12 | 13 | @interface SSFadingScrollView () 14 | 15 | @property (nonatomic) CALayer *maskLayer; 16 | @property (nonatomic) CAGradientLayer *gradientLayer; 17 | 18 | @property (nonatomic) UIImageView *verticalScrollBar; 19 | @property (nonatomic) UIImageView *horizontalScrollBar; 20 | @property (nonatomic) CALayer *verticalScrollBarLayer; 21 | @property (nonatomic) CALayer *horizontalScrollBarLayer; 22 | 23 | @end 24 | 25 | @implementation SSFadingScrollView 26 | 27 | #pragma mark - Initializers 28 | 29 | - (instancetype)initWithFadeSize:(CGFloat)fadeSize axis:(SSScrollViewFadeAxis)fadeAxis 30 | { 31 | self = [super initWithFrame:CGRectZero]; 32 | if (self) { 33 | [self setDefaults]; 34 | _fadeSize = fadeSize; 35 | _fadeAxis = fadeAxis; 36 | } 37 | return self; 38 | } 39 | 40 | - (instancetype)initWithFadeSize:(CGFloat)fadeSize 41 | { 42 | return [self initWithFadeSize:fadeSize axis:SSScrollViewFadeAxisVertical]; 43 | } 44 | 45 | - (instancetype)init 46 | { 47 | return [self initWithFadeSize:SSDefaultFadeSize]; 48 | } 49 | 50 | - (instancetype)initWithFrame:(CGRect)frame 51 | { 52 | self = [self init]; 53 | if (self) { 54 | [self setDefaults]; 55 | self.frame = frame; 56 | } 57 | return self; 58 | } 59 | 60 | - (instancetype)initWithCoder:(NSCoder *)coder 61 | { 62 | self = [super initWithCoder:coder]; 63 | if (self) { 64 | [self setDefaults]; 65 | } 66 | return self; 67 | } 68 | 69 | - (void)setDefaults 70 | { 71 | _fadeAxis = SSScrollViewFadeAxisVertical; 72 | _fadeLeadingEdge = YES; 73 | _fadeTrailingEdge = YES; 74 | _fadeSize = SSDefaultFadeSize; 75 | _fadeDuration = SSDefaultFadeDuration; 76 | _maskScrollBars = YES; 77 | } 78 | 79 | - (void)dealloc 80 | { 81 | if (_verticalScrollBar) { 82 | [_verticalScrollBar removeObserver:self forKeyPath:@"alpha" context:SSContext]; 83 | } 84 | if (_horizontalScrollBar) { 85 | [_horizontalScrollBar removeObserver:self forKeyPath:@"alpha" context:SSContext]; 86 | } 87 | } 88 | 89 | #pragma mark - Layout 90 | 91 | - (void)layoutSubviews 92 | { 93 | [super layoutSubviews]; 94 | [self updateMask]; 95 | } 96 | 97 | - (void)updateMask 98 | { 99 | [CATransaction begin]; 100 | [CATransaction setDisableActions:YES]; 101 | self.maskLayer.frame = self.bounds; 102 | [CATransaction commit]; 103 | 104 | [self updateGradients]; 105 | [self updateScrollBarMasks]; 106 | } 107 | 108 | - (void)updateGradients 109 | { 110 | self.gradientLayer.frame = self.maskLayer.bounds; 111 | NSInteger contentOffset = roundf(self.isVertical ? self.contentOffset.y : self.contentOffset.x); 112 | 113 | if (self.fadeLeadingEdge) { 114 | if (!self.leadingGradientIsHidden && contentOffset <= 0) { 115 | [self animateLeadingGradientToColor:[SSFadingScrollView opaqueColor]]; // fade out 116 | } 117 | else if (self.leadingGradientIsHidden && contentOffset > 0) { 118 | [self animateLeadingGradientToColor:[SSFadingScrollView transparentColor]]; // fade in 119 | } 120 | } 121 | if (self.fadeTrailingEdge) { 122 | NSInteger maxContentOffset; 123 | if (self.isVertical) { 124 | maxContentOffset = roundf(self.contentSize.height - CGRectGetHeight(self.bounds)); 125 | } 126 | else { 127 | maxContentOffset = roundf(self.contentSize.width - CGRectGetWidth(self.bounds)); 128 | } 129 | 130 | if (!self.trailingGradientIsHidden && contentOffset >= maxContentOffset) { 131 | [self animateTrailingGradientToColor:[SSFadingScrollView opaqueColor]]; 132 | } 133 | else if (self.trailingGradientIsHidden && contentOffset < maxContentOffset) { 134 | [self animateTrailingGradientToColor:[SSFadingScrollView transparentColor]]; 135 | } 136 | } 137 | } 138 | 139 | #pragma mark - Properties 140 | 141 | - (BOOL)isVertical 142 | { 143 | return self.fadeAxis == SSScrollViewFadeAxisVertical; 144 | } 145 | 146 | - (CALayer *)maskLayer 147 | { 148 | if (!_maskLayer) { 149 | _maskLayer = [self setupMaskLayer]; 150 | } 151 | return _maskLayer; 152 | } 153 | 154 | - (CALayer *)verticalScrollBarLayer 155 | { 156 | if (!_verticalScrollBarLayer) { 157 | _verticalScrollBarLayer = [self setupVerticalScrollBarLayer]; 158 | } 159 | 160 | return _verticalScrollBarLayer; 161 | } 162 | 163 | - (CALayer *)horizontalScrollBarLayer 164 | { 165 | if (!_horizontalScrollBarLayer) { 166 | _horizontalScrollBarLayer = [self setupHorizontalScrollBarLayer]; 167 | } 168 | 169 | return _horizontalScrollBarLayer; 170 | } 171 | 172 | - (BOOL)leadingGradientIsHidden 173 | { 174 | CGColorRef firstColor = (__bridge CGColorRef)self.gradientLayer.colors.firstObject; 175 | return CGColorEqualToColor(firstColor, [SSFadingScrollView opaqueColor]); 176 | } 177 | 178 | - (BOOL)trailingGradientIsHidden 179 | { 180 | CGColorRef lastColor = (__bridge CGColorRef)self.gradientLayer.colors.lastObject; 181 | return CGColorEqualToColor(lastColor, [SSFadingScrollView opaqueColor]); 182 | } 183 | 184 | #pragma mark - Mask 185 | 186 | - (CALayer *)setupMaskLayer 187 | { 188 | CALayer *maskLayer = [CALayer layer]; 189 | maskLayer.frame = self.bounds; 190 | 191 | self.gradientLayer = [self setupGradientLayer]; 192 | [maskLayer addSublayer:self.gradientLayer]; 193 | 194 | if (self.maskScrollBars) { 195 | [maskLayer addSublayer:self.verticalScrollBarLayer]; 196 | [maskLayer addSublayer:self.horizontalScrollBarLayer]; 197 | } 198 | 199 | self.layer.mask = maskLayer; 200 | 201 | return maskLayer; 202 | } 203 | 204 | #pragma mark Mask colors 205 | 206 | + (CGColorRef)opaqueColor 207 | { 208 | return [UIColor blackColor].CGColor; 209 | } 210 | 211 | + (CGColorRef)transparentColor 212 | { 213 | return [UIColor clearColor].CGColor; 214 | } 215 | 216 | #pragma mark - Gradient mask 217 | 218 | - (CAGradientLayer *)setupGradientLayer 219 | { 220 | id transparent = (id)[SSFadingScrollView transparentColor]; 221 | id opaque = (id)[SSFadingScrollView opaqueColor]; 222 | 223 | CAGradientLayer *gradientLayer = [CAGradientLayer layer]; 224 | CGRect frame = self.bounds; 225 | frame.origin = CGPointZero; 226 | gradientLayer.frame = frame; 227 | 228 | NSArray *colors = [NSArray new]; 229 | NSArray *locations = [NSArray new]; 230 | 231 | CGFloat fadePercentage = [self percentageForFadeSize]; 232 | 233 | if (self.fadeLeadingEdge) { 234 | colors = @[transparent, opaque]; 235 | locations = @[@(0), @(fadePercentage)]; 236 | } 237 | if (self.fadeTrailingEdge) { 238 | colors = [colors arrayByAddingObjectsFromArray:@[opaque, transparent]]; 239 | locations = [locations arrayByAddingObjectsFromArray:@[@(1.0 - fadePercentage), @(1)]]; 240 | } 241 | 242 | gradientLayer.colors = colors; 243 | gradientLayer.locations = locations; 244 | 245 | if (self.isVertical) { 246 | gradientLayer.startPoint = CGPointMake(0.5, 0); 247 | gradientLayer.endPoint = CGPointMake(0.5, 1); 248 | } 249 | else { 250 | gradientLayer.startPoint = CGPointMake(0, 0.5); 251 | gradientLayer.endPoint = CGPointMake(1, 0.5); 252 | } 253 | 254 | return gradientLayer; 255 | } 256 | 257 | - (CGFloat)percentageForFadeSize 258 | { 259 | CGFloat size = self.isVertical ? CGRectGetHeight(self.bounds) : CGRectGetWidth(self.bounds); 260 | 261 | if (size <= 0) { 262 | return 0; 263 | } 264 | 265 | CGFloat maxFadePercentage = (self.fadeLeadingEdge && self.fadeTrailingEdge) ? 0.5 : 1.0; 266 | return fminf(self.fadeSize / size, maxFadePercentage); 267 | } 268 | 269 | #pragma mark Gradient animation 270 | 271 | - (void)animateLeadingGradientToColor:(CGColorRef)color 272 | { 273 | NSArray *colours = [self colorsArrayByReplacingObjectAtIndex:0 withColor:color]; 274 | [self animateGradientColours:colours]; 275 | } 276 | 277 | - (void)animateTrailingGradientToColor:(CGColorRef)color 278 | { 279 | NSUInteger lastIndex = self.gradientLayer.colors.count - 1; 280 | NSArray *colours = [self colorsArrayByReplacingObjectAtIndex:lastIndex withColor:color]; 281 | [self animateGradientColours:colours]; 282 | } 283 | 284 | - (NSArray *)colorsArrayByReplacingObjectAtIndex:(NSUInteger)index withColor:(CGColorRef)color 285 | { 286 | NSMutableArray *mutableColours = [self.gradientLayer.colors mutableCopy]; 287 | mutableColours[index] = (__bridge id)color; 288 | 289 | return [mutableColours copy]; 290 | } 291 | 292 | - (void)animateGradientColours:(NSArray *)colours 293 | { 294 | CABasicAnimation *animation; 295 | animation = [CABasicAnimation animationWithKeyPath:@"colors"]; 296 | animation.fromValue = ((CAGradientLayer *)self.gradientLayer.presentationLayer).colors; 297 | animation.toValue = colours; 298 | animation.duration = self.fadeDuration; 299 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 300 | 301 | [CATransaction begin]; 302 | [CATransaction setDisableActions:YES]; 303 | self.gradientLayer.colors = colours; // update the model value 304 | [CATransaction commit]; 305 | 306 | [self.gradientLayer addAnimation:animation forKey:@"animateGradient"]; 307 | } 308 | 309 | #pragma mark - Scroll bar mask 310 | 311 | - (CALayer *)setupVerticalScrollBarLayer 312 | { 313 | if (!self.verticalScrollBar) { 314 | [self findScrollBars]; 315 | 316 | if (!self.verticalScrollBar) { 317 | return nil; 318 | } 319 | } 320 | 321 | [self.verticalScrollBar addObserver:self forKeyPath:@"alpha" options:0 context:SSContext]; 322 | 323 | return [self scrollBarLayerWithFrame:self.verticalScrollBar.frame]; 324 | } 325 | 326 | - (CALayer *)setupHorizontalScrollBarLayer 327 | { 328 | if (!self.horizontalScrollBar) { 329 | [self findScrollBars]; 330 | 331 | if (!self.horizontalScrollBar) { 332 | return nil; 333 | } 334 | } 335 | 336 | [self.horizontalScrollBar addObserver:self forKeyPath:@"alpha" options:0 context:SSContext]; 337 | 338 | return [self scrollBarLayerWithFrame:self.horizontalScrollBar.frame]; 339 | } 340 | 341 | - (void)findScrollBars 342 | { 343 | for (UIView *subview in self.subviews) { 344 | if ([subview isKindOfClass:[UIImageView class]] && subview.tag == 0) { 345 | UIImageView *imageView = (UIImageView *)subview; 346 | 347 | if (imageView.frame.size.width == 3.5 || 348 | imageView.frame.size.width == 2.5 || 349 | (imageView.frame.size.width < 2.4 && imageView.frame.size.width > 2.3)) 350 | { 351 | self.verticalScrollBar = imageView; 352 | } 353 | else if (imageView.frame.size.height == 3.5 || 354 | imageView.frame.size.height == 2.5 || 355 | (imageView.frame.size.height < 2.4 && imageView.frame.size.height > 2.3)) 356 | { 357 | self.horizontalScrollBar = imageView; 358 | } 359 | } 360 | } 361 | } 362 | 363 | - (CALayer *)scrollBarLayerWithFrame:(CGRect)frame 364 | { 365 | CALayer *scrollBarLayer = [CALayer layer]; 366 | scrollBarLayer.backgroundColor = [SSFadingScrollView opaqueColor]; 367 | scrollBarLayer.frame = frame; 368 | 369 | return scrollBarLayer; 370 | } 371 | 372 | - (void)updateScrollBarMasks 373 | { 374 | if (self.maskScrollBars) { 375 | [CATransaction begin]; 376 | [CATransaction setDisableActions:YES]; 377 | 378 | CGRect verticalScrollBarFrame = [self.layer convertRect:self.verticalScrollBar.frame 379 | toLayer:self.maskLayer]; 380 | self.verticalScrollBarLayer.frame = verticalScrollBarFrame; 381 | self.verticalScrollBarLayer.opacity = self.verticalScrollBar.alpha; 382 | 383 | CGRect horizontalScrollBarFrame = [self.layer convertRect:self.horizontalScrollBar.frame 384 | toLayer:self.maskLayer]; 385 | self.horizontalScrollBarLayer.frame = horizontalScrollBarFrame; 386 | self.horizontalScrollBarLayer.opacity = self.horizontalScrollBar.alpha; 387 | 388 | [CATransaction commit]; 389 | } 390 | } 391 | 392 | - (void)observeValueForKeyPath:(NSString *)keyPath 393 | ofObject:(id)object 394 | change:(NSDictionary *)change 395 | context:(void *)context 396 | { 397 | if (context != SSContext) { 398 | return; 399 | } 400 | 401 | if([keyPath isEqualToString:@"alpha"] && [object valueForKeyPath:keyPath] != [NSNull null]) { 402 | [self layoutSubviews]; 403 | } 404 | } 405 | 406 | #pragma mark - Deprecated 407 | 408 | - (instancetype)initWithFadeHeight:(CGFloat)fadeHeight edges:(FadeEdges)fadeEdges 409 | { 410 | self = [self initWithFadeSize:fadeHeight]; 411 | if (self) { 412 | switch (fadeEdges) { 413 | case FadeEdgesTopAndBottom: 414 | _fadeLeadingEdge = YES; 415 | _fadeTrailingEdge = YES; 416 | break; 417 | case FadeEdgesTop: 418 | _fadeLeadingEdge = YES; 419 | _fadeTrailingEdge = NO; 420 | break; 421 | case FadeEdgesBottom: 422 | _fadeLeadingEdge = NO; 423 | _fadeTrailingEdge = YES; 424 | break; 425 | default: 426 | break; 427 | } 428 | } 429 | return self; 430 | } 431 | 432 | - (instancetype)initWithFadeHeight:(CGFloat)fadeHeight 433 | { 434 | return [self initWithFadeSize:fadeHeight]; 435 | } 436 | 437 | - (BOOL)fadeTop; 438 | { 439 | return self.fadeLeadingEdge; 440 | } 441 | 442 | - (void)setFadeTop:(BOOL)fade; 443 | { 444 | self.fadeLeadingEdge = fade; 445 | } 446 | 447 | - (BOOL)fadeBottom; 448 | { 449 | return self.fadeTrailingEdge; 450 | } 451 | 452 | - (void)setFadeBottom:(BOOL)fade; 453 | { 454 | self.fadeTrailingEdge = fade; 455 | } 456 | 457 | - (CGFloat)fadeHeight; 458 | { 459 | return self.fadeSize; 460 | } 461 | 462 | - (void)setFadeHeight:(CGFloat)height; 463 | { 464 | self.fadeSize = height; 465 | } 466 | 467 | @end 468 | -------------------------------------------------------------------------------- /SSFadingScrollViewDemo/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SSFadingScrollViewDemo/Images.xcassets/coffee-1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "coffee-1.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /SSFadingScrollViewDemo/Images.xcassets/coffee-1.imageset/coffee-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stephsharp/SSFadingScrollView/366188d2b7f7961338f6c5fc917ab3ed087016fd/SSFadingScrollViewDemo/Images.xcassets/coffee-1.imageset/coffee-1.png -------------------------------------------------------------------------------- /SSFadingScrollViewDemo/Images.xcassets/coffee-2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "coffee-2.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /SSFadingScrollViewDemo/Images.xcassets/coffee-2.imageset/coffee-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stephsharp/SSFadingScrollView/366188d2b7f7961338f6c5fc917ab3ed087016fd/SSFadingScrollViewDemo/Images.xcassets/coffee-2.imageset/coffee-2.png -------------------------------------------------------------------------------- /SSFadingScrollViewDemo/Images.xcassets/coffee-3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "coffee-3.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /SSFadingScrollViewDemo/Images.xcassets/coffee-3.imageset/coffee-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stephsharp/SSFadingScrollView/366188d2b7f7961338f6c5fc917ab3ed087016fd/SSFadingScrollViewDemo/Images.xcassets/coffee-3.imageset/coffee-3.png -------------------------------------------------------------------------------- /SSFadingScrollViewDemo/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 28 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /SSFadingScrollViewDemo/SSAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSAppDelegate.h 3 | // FadingScrollViewDemo 4 | // 5 | // Created by Stephanie Sharp on 30/07/13. 6 | // Copyright (c) 2013 Stephanie Sharp. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SSAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SSFadingScrollViewDemo/SSAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSAppDelegate.m 3 | // FadingScrollViewDemo 4 | // 5 | // Created by Stephanie Sharp on 30/07/13. 6 | // Copyright (c) 2013 Stephanie Sharp. All rights reserved. 7 | // 8 | 9 | #import "SSAppDelegate.h" 10 | 11 | @implementation SSAppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // 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. 22 | // 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. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 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 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /SSFadingScrollViewDemo/SSFadingScrollViewDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | MainStoryboard 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /SSFadingScrollViewDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /SSFadingScrollViewDemo/en.lproj/MainStoryboard.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | -------------------------------------------------------------------------------- /SSFadingScrollViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FadingScrollViewDemo 4 | // 5 | // Created by Stephanie Sharp on 30/07/13. 6 | // Copyright (c) 2013 Stephanie Sharp. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "SSAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([SSAppDelegate class])); 17 | } 18 | } 19 | --------------------------------------------------------------------------------