├── .gitignore ├── .travis.yml ├── LICENSE ├── LazyFadeInView.podspec ├── LazyFadeInView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── LazyFadeInView.xccheckout │ └── xcuserdata │ │ ├── Chandler.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ ├── hewenjun.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── hpcc.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings ├── xcshareddata │ └── xcschemes │ │ └── LazyFadeInView.xcscheme └── xcuserdata │ ├── Chandler.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ └── xcschememanagement.plist │ ├── hewenjun.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ ├── LazyFadeInView.xcscheme │ │ └── xcschememanagement.plist │ └── hpcc.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── LazyFadeInView.xcscheme │ └── xcschememanagement.plist ├── LazyFadeInView ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── Main_iPad.storyboard │ └── Main_iPhone.storyboard ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── LazyFadeInView-Info.plist ├── LazyFadeInView-Prefix.pch ├── LazyFadeInView │ ├── LazyFadeIn.h │ ├── LazyFadeInLayer.h │ ├── LazyFadeInLayer.m │ ├── LazyFadeInView.h │ ├── LazyFadeInView.m │ ├── NSString+LFEmoji.h │ └── NSString+LFEmoji.m ├── ViewController.h ├── ViewController.m ├── en.lproj │ └── InfoPlist.strings └── main.m ├── LazyFadeInViewTests ├── LazyFadeInViewTests-Info.plist ├── LazyFadeInViewTests.m └── en.lproj │ └── InfoPlist.strings └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # CocoaPods 2 | # 3 | # We recommend against adding the Pods directory to your .gitignore. However 4 | # you should judge for yourself, the pros and cons are mentioned at: 5 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control? 6 | # 7 | # Pods/ 8 | 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | xcode_project: LazyFadeInView.xcodeproj 3 | xcode_scheme: LazyFadeInView 4 | xcode_sdk: 5 | - iphonesimulator8.1 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 tuyou 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. -------------------------------------------------------------------------------- /LazyFadeInView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "LazyFadeInView" 3 | s.version = "0.1.1" 4 | s.summary = "A cool way to animate the appearance of a label. Like the app Secret" 5 | s.homepage = "https://github.com/itouch2/LazyFadeInView" 6 | s.license = "MIT" 7 | s.authors = { "tuyou" => "yoututouch@gmail.com", "xinjixjz" => "xinjixjz@gmail.com"} 8 | s.source = { :git => "https://github.com/itouch2/LazyFadeInView.git", :tag => "v0.1.1" } 9 | s.frameworks = 'Foundation', 'CoreGraphics', 'UIKit' 10 | s.platform = :ios, '6.0' 11 | s.source_files = 'LazyFadeInView/LazyFadeInView/*.{h,m}' 12 | s.screenshot = "https://www.dropbox.com/s/lz9kl5oagkqbwf4/LazyFadeInView.png" 13 | s.requires_arc = true 14 | end 15 | -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | CB028D3E1903E0660044B86F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB028D3D1903E0660044B86F /* Foundation.framework */; }; 11 | CB028D401903E0660044B86F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB028D3F1903E0660044B86F /* CoreGraphics.framework */; }; 12 | CB028D421903E0660044B86F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB028D411903E0660044B86F /* UIKit.framework */; }; 13 | CB028D481903E0660044B86F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = CB028D461903E0660044B86F /* InfoPlist.strings */; }; 14 | CB028D4A1903E0660044B86F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CB028D491903E0660044B86F /* main.m */; }; 15 | CB028D4E1903E0660044B86F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CB028D4D1903E0660044B86F /* AppDelegate.m */; }; 16 | CB028D511903E0660044B86F /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CB028D4F1903E0660044B86F /* Main_iPhone.storyboard */; }; 17 | CB028D541903E0660044B86F /* Main_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CB028D521903E0660044B86F /* Main_iPad.storyboard */; }; 18 | CB028D571903E0660044B86F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CB028D561903E0660044B86F /* ViewController.m */; }; 19 | CB028D591903E0660044B86F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CB028D581903E0660044B86F /* Images.xcassets */; }; 20 | CB028D601903E0660044B86F /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB028D5F1903E0660044B86F /* XCTest.framework */; }; 21 | CB028D611903E0660044B86F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB028D3D1903E0660044B86F /* Foundation.framework */; }; 22 | CB028D621903E0660044B86F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB028D411903E0660044B86F /* UIKit.framework */; }; 23 | CB028D6A1903E0660044B86F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = CB028D681903E0660044B86F /* InfoPlist.strings */; }; 24 | CB028D6C1903E0660044B86F /* LazyFadeInViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CB028D6B1903E0660044B86F /* LazyFadeInViewTests.m */; }; 25 | CB028D781903E0A10044B86F /* LazyFadeInView.m in Sources */ = {isa = PBXBuildFile; fileRef = CB028D771903E0A10044B86F /* LazyFadeInView.m */; }; 26 | CB028D7B1903E10C0044B86F /* LazyFadeInLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = CB028D7A1903E10C0044B86F /* LazyFadeInLayer.m */; }; 27 | CBA2DD0D1C844BFC00FC6065 /* NSString+LFEmoji.m in Sources */ = {isa = PBXBuildFile; fileRef = CBA2DD0C1C844BFC00FC6065 /* NSString+LFEmoji.m */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXContainerItemProxy section */ 31 | CB028D631903E0660044B86F /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = CB028D321903E0660044B86F /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = CB028D391903E0660044B86F; 36 | remoteInfo = LazyFadeInView; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | CB028D3A1903E0660044B86F /* LazyFadeInView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LazyFadeInView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | CB028D3D1903E0660044B86F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 43 | CB028D3F1903E0660044B86F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 44 | CB028D411903E0660044B86F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 45 | CB028D451903E0660044B86F /* LazyFadeInView-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "LazyFadeInView-Info.plist"; sourceTree = ""; }; 46 | CB028D471903E0660044B86F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 47 | CB028D491903E0660044B86F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 48 | CB028D4B1903E0660044B86F /* LazyFadeInView-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "LazyFadeInView-Prefix.pch"; sourceTree = ""; }; 49 | CB028D4C1903E0660044B86F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 50 | CB028D4D1903E0660044B86F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 51 | CB028D501903E0660044B86F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPhone.storyboard; sourceTree = ""; }; 52 | CB028D531903E0660044B86F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPad.storyboard; sourceTree = ""; }; 53 | CB028D551903E0660044B86F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 54 | CB028D561903E0660044B86F /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 55 | CB028D581903E0660044B86F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 56 | CB028D5E1903E0660044B86F /* LazyFadeInViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LazyFadeInViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | CB028D5F1903E0660044B86F /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 58 | CB028D671903E0660044B86F /* LazyFadeInViewTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "LazyFadeInViewTests-Info.plist"; sourceTree = ""; }; 59 | CB028D691903E0660044B86F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 60 | CB028D6B1903E0660044B86F /* LazyFadeInViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LazyFadeInViewTests.m; sourceTree = ""; }; 61 | CB028D761903E0A10044B86F /* LazyFadeInView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LazyFadeInView.h; sourceTree = ""; }; 62 | CB028D771903E0A10044B86F /* LazyFadeInView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LazyFadeInView.m; sourceTree = ""; }; 63 | CB028D791903E10C0044B86F /* LazyFadeInLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LazyFadeInLayer.h; sourceTree = ""; }; 64 | CB028D7A1903E10C0044B86F /* LazyFadeInLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LazyFadeInLayer.m; sourceTree = ""; }; 65 | CB2DA0D619056C7500E152D1 /* LazyFadeIn.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LazyFadeIn.h; sourceTree = ""; }; 66 | CBA2DD0B1C844BFC00FC6065 /* NSString+LFEmoji.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+LFEmoji.h"; sourceTree = ""; }; 67 | CBA2DD0C1C844BFC00FC6065 /* NSString+LFEmoji.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+LFEmoji.m"; sourceTree = ""; }; 68 | /* End PBXFileReference section */ 69 | 70 | /* Begin PBXFrameworksBuildPhase section */ 71 | CB028D371903E0660044B86F /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | CB028D401903E0660044B86F /* CoreGraphics.framework in Frameworks */, 76 | CB028D421903E0660044B86F /* UIKit.framework in Frameworks */, 77 | CB028D3E1903E0660044B86F /* Foundation.framework in Frameworks */, 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | CB028D5B1903E0660044B86F /* Frameworks */ = { 82 | isa = PBXFrameworksBuildPhase; 83 | buildActionMask = 2147483647; 84 | files = ( 85 | CB028D601903E0660044B86F /* XCTest.framework in Frameworks */, 86 | CB028D621903E0660044B86F /* UIKit.framework in Frameworks */, 87 | CB028D611903E0660044B86F /* Foundation.framework in Frameworks */, 88 | ); 89 | runOnlyForDeploymentPostprocessing = 0; 90 | }; 91 | /* End PBXFrameworksBuildPhase section */ 92 | 93 | /* Begin PBXGroup section */ 94 | CB028D311903E0660044B86F = { 95 | isa = PBXGroup; 96 | children = ( 97 | CB028D431903E0660044B86F /* LazyFadeInView */, 98 | CB028D651903E0660044B86F /* LazyFadeInViewTests */, 99 | CB028D3C1903E0660044B86F /* Frameworks */, 100 | CB028D3B1903E0660044B86F /* Products */, 101 | ); 102 | sourceTree = ""; 103 | }; 104 | CB028D3B1903E0660044B86F /* Products */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | CB028D3A1903E0660044B86F /* LazyFadeInView.app */, 108 | CB028D5E1903E0660044B86F /* LazyFadeInViewTests.xctest */, 109 | ); 110 | name = Products; 111 | sourceTree = ""; 112 | }; 113 | CB028D3C1903E0660044B86F /* Frameworks */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | CB028D3D1903E0660044B86F /* Foundation.framework */, 117 | CB028D3F1903E0660044B86F /* CoreGraphics.framework */, 118 | CB028D411903E0660044B86F /* UIKit.framework */, 119 | CB028D5F1903E0660044B86F /* XCTest.framework */, 120 | ); 121 | name = Frameworks; 122 | sourceTree = ""; 123 | }; 124 | CB028D431903E0660044B86F /* LazyFadeInView */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | CB028D751903E0900044B86F /* LazyFadeInView */, 128 | CB028D4C1903E0660044B86F /* AppDelegate.h */, 129 | CB028D4D1903E0660044B86F /* AppDelegate.m */, 130 | CB028D4F1903E0660044B86F /* Main_iPhone.storyboard */, 131 | CB028D521903E0660044B86F /* Main_iPad.storyboard */, 132 | CB028D551903E0660044B86F /* ViewController.h */, 133 | CB028D561903E0660044B86F /* ViewController.m */, 134 | CB028D581903E0660044B86F /* Images.xcassets */, 135 | CB028D441903E0660044B86F /* Supporting Files */, 136 | ); 137 | path = LazyFadeInView; 138 | sourceTree = ""; 139 | }; 140 | CB028D441903E0660044B86F /* Supporting Files */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | CB028D451903E0660044B86F /* LazyFadeInView-Info.plist */, 144 | CB028D461903E0660044B86F /* InfoPlist.strings */, 145 | CB028D491903E0660044B86F /* main.m */, 146 | CB028D4B1903E0660044B86F /* LazyFadeInView-Prefix.pch */, 147 | ); 148 | name = "Supporting Files"; 149 | sourceTree = ""; 150 | }; 151 | CB028D651903E0660044B86F /* LazyFadeInViewTests */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | CB028D6B1903E0660044B86F /* LazyFadeInViewTests.m */, 155 | CB028D661903E0660044B86F /* Supporting Files */, 156 | ); 157 | path = LazyFadeInViewTests; 158 | sourceTree = ""; 159 | }; 160 | CB028D661903E0660044B86F /* Supporting Files */ = { 161 | isa = PBXGroup; 162 | children = ( 163 | CB028D671903E0660044B86F /* LazyFadeInViewTests-Info.plist */, 164 | CB028D681903E0660044B86F /* InfoPlist.strings */, 165 | ); 166 | name = "Supporting Files"; 167 | sourceTree = ""; 168 | }; 169 | CB028D751903E0900044B86F /* LazyFadeInView */ = { 170 | isa = PBXGroup; 171 | children = ( 172 | CB2DA0D619056C7500E152D1 /* LazyFadeIn.h */, 173 | CB028D761903E0A10044B86F /* LazyFadeInView.h */, 174 | CB028D771903E0A10044B86F /* LazyFadeInView.m */, 175 | CB028D791903E10C0044B86F /* LazyFadeInLayer.h */, 176 | CB028D7A1903E10C0044B86F /* LazyFadeInLayer.m */, 177 | CBA2DD0B1C844BFC00FC6065 /* NSString+LFEmoji.h */, 178 | CBA2DD0C1C844BFC00FC6065 /* NSString+LFEmoji.m */, 179 | ); 180 | path = LazyFadeInView; 181 | sourceTree = ""; 182 | }; 183 | /* End PBXGroup section */ 184 | 185 | /* Begin PBXNativeTarget section */ 186 | CB028D391903E0660044B86F /* LazyFadeInView */ = { 187 | isa = PBXNativeTarget; 188 | buildConfigurationList = CB028D6F1903E0660044B86F /* Build configuration list for PBXNativeTarget "LazyFadeInView" */; 189 | buildPhases = ( 190 | CB028D361903E0660044B86F /* Sources */, 191 | CB028D371903E0660044B86F /* Frameworks */, 192 | CB028D381903E0660044B86F /* Resources */, 193 | ); 194 | buildRules = ( 195 | ); 196 | dependencies = ( 197 | ); 198 | name = LazyFadeInView; 199 | productName = LazyFadeInView; 200 | productReference = CB028D3A1903E0660044B86F /* LazyFadeInView.app */; 201 | productType = "com.apple.product-type.application"; 202 | }; 203 | CB028D5D1903E0660044B86F /* LazyFadeInViewTests */ = { 204 | isa = PBXNativeTarget; 205 | buildConfigurationList = CB028D721903E0660044B86F /* Build configuration list for PBXNativeTarget "LazyFadeInViewTests" */; 206 | buildPhases = ( 207 | CB028D5A1903E0660044B86F /* Sources */, 208 | CB028D5B1903E0660044B86F /* Frameworks */, 209 | CB028D5C1903E0660044B86F /* Resources */, 210 | ); 211 | buildRules = ( 212 | ); 213 | dependencies = ( 214 | CB028D641903E0660044B86F /* PBXTargetDependency */, 215 | ); 216 | name = LazyFadeInViewTests; 217 | productName = LazyFadeInViewTests; 218 | productReference = CB028D5E1903E0660044B86F /* LazyFadeInViewTests.xctest */; 219 | productType = "com.apple.product-type.bundle.unit-test"; 220 | }; 221 | /* End PBXNativeTarget section */ 222 | 223 | /* Begin PBXProject section */ 224 | CB028D321903E0660044B86F /* Project object */ = { 225 | isa = PBXProject; 226 | attributes = { 227 | LastUpgradeCheck = 0510; 228 | ORGANIZATIONNAME = "Tu You"; 229 | TargetAttributes = { 230 | CB028D5D1903E0660044B86F = { 231 | TestTargetID = CB028D391903E0660044B86F; 232 | }; 233 | }; 234 | }; 235 | buildConfigurationList = CB028D351903E0660044B86F /* Build configuration list for PBXProject "LazyFadeInView" */; 236 | compatibilityVersion = "Xcode 3.2"; 237 | developmentRegion = English; 238 | hasScannedForEncodings = 0; 239 | knownRegions = ( 240 | en, 241 | Base, 242 | ); 243 | mainGroup = CB028D311903E0660044B86F; 244 | productRefGroup = CB028D3B1903E0660044B86F /* Products */; 245 | projectDirPath = ""; 246 | projectRoot = ""; 247 | targets = ( 248 | CB028D391903E0660044B86F /* LazyFadeInView */, 249 | CB028D5D1903E0660044B86F /* LazyFadeInViewTests */, 250 | ); 251 | }; 252 | /* End PBXProject section */ 253 | 254 | /* Begin PBXResourcesBuildPhase section */ 255 | CB028D381903E0660044B86F /* Resources */ = { 256 | isa = PBXResourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | CB028D541903E0660044B86F /* Main_iPad.storyboard in Resources */, 260 | CB028D591903E0660044B86F /* Images.xcassets in Resources */, 261 | CB028D511903E0660044B86F /* Main_iPhone.storyboard in Resources */, 262 | CB028D481903E0660044B86F /* InfoPlist.strings in Resources */, 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | }; 266 | CB028D5C1903E0660044B86F /* Resources */ = { 267 | isa = PBXResourcesBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | CB028D6A1903E0660044B86F /* InfoPlist.strings in Resources */, 271 | ); 272 | runOnlyForDeploymentPostprocessing = 0; 273 | }; 274 | /* End PBXResourcesBuildPhase section */ 275 | 276 | /* Begin PBXSourcesBuildPhase section */ 277 | CB028D361903E0660044B86F /* Sources */ = { 278 | isa = PBXSourcesBuildPhase; 279 | buildActionMask = 2147483647; 280 | files = ( 281 | CB028D571903E0660044B86F /* ViewController.m in Sources */, 282 | CB028D781903E0A10044B86F /* LazyFadeInView.m in Sources */, 283 | CB028D7B1903E10C0044B86F /* LazyFadeInLayer.m in Sources */, 284 | CB028D4E1903E0660044B86F /* AppDelegate.m in Sources */, 285 | CBA2DD0D1C844BFC00FC6065 /* NSString+LFEmoji.m in Sources */, 286 | CB028D4A1903E0660044B86F /* main.m in Sources */, 287 | ); 288 | runOnlyForDeploymentPostprocessing = 0; 289 | }; 290 | CB028D5A1903E0660044B86F /* Sources */ = { 291 | isa = PBXSourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | CB028D6C1903E0660044B86F /* LazyFadeInViewTests.m in Sources */, 295 | ); 296 | runOnlyForDeploymentPostprocessing = 0; 297 | }; 298 | /* End PBXSourcesBuildPhase section */ 299 | 300 | /* Begin PBXTargetDependency section */ 301 | CB028D641903E0660044B86F /* PBXTargetDependency */ = { 302 | isa = PBXTargetDependency; 303 | target = CB028D391903E0660044B86F /* LazyFadeInView */; 304 | targetProxy = CB028D631903E0660044B86F /* PBXContainerItemProxy */; 305 | }; 306 | /* End PBXTargetDependency section */ 307 | 308 | /* Begin PBXVariantGroup section */ 309 | CB028D461903E0660044B86F /* InfoPlist.strings */ = { 310 | isa = PBXVariantGroup; 311 | children = ( 312 | CB028D471903E0660044B86F /* en */, 313 | ); 314 | name = InfoPlist.strings; 315 | sourceTree = ""; 316 | }; 317 | CB028D4F1903E0660044B86F /* Main_iPhone.storyboard */ = { 318 | isa = PBXVariantGroup; 319 | children = ( 320 | CB028D501903E0660044B86F /* Base */, 321 | ); 322 | name = Main_iPhone.storyboard; 323 | sourceTree = ""; 324 | }; 325 | CB028D521903E0660044B86F /* Main_iPad.storyboard */ = { 326 | isa = PBXVariantGroup; 327 | children = ( 328 | CB028D531903E0660044B86F /* Base */, 329 | ); 330 | name = Main_iPad.storyboard; 331 | sourceTree = ""; 332 | }; 333 | CB028D681903E0660044B86F /* InfoPlist.strings */ = { 334 | isa = PBXVariantGroup; 335 | children = ( 336 | CB028D691903E0660044B86F /* en */, 337 | ); 338 | name = InfoPlist.strings; 339 | sourceTree = ""; 340 | }; 341 | /* End PBXVariantGroup section */ 342 | 343 | /* Begin XCBuildConfiguration section */ 344 | CB028D6D1903E0660044B86F /* Debug */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ALWAYS_SEARCH_USER_PATHS = NO; 348 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 349 | CLANG_CXX_LIBRARY = "libc++"; 350 | CLANG_ENABLE_MODULES = YES; 351 | CLANG_ENABLE_OBJC_ARC = YES; 352 | CLANG_WARN_BOOL_CONVERSION = YES; 353 | CLANG_WARN_CONSTANT_CONVERSION = YES; 354 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 355 | CLANG_WARN_EMPTY_BODY = YES; 356 | CLANG_WARN_ENUM_CONVERSION = YES; 357 | CLANG_WARN_INT_CONVERSION = YES; 358 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 360 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 361 | COPY_PHASE_STRIP = NO; 362 | GCC_C_LANGUAGE_STANDARD = gnu99; 363 | GCC_DYNAMIC_NO_PIC = NO; 364 | GCC_OPTIMIZATION_LEVEL = 0; 365 | GCC_PREPROCESSOR_DEFINITIONS = ( 366 | "DEBUG=1", 367 | "$(inherited)", 368 | ); 369 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 370 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 371 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 372 | GCC_WARN_UNDECLARED_SELECTOR = YES; 373 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 374 | GCC_WARN_UNUSED_FUNCTION = YES; 375 | GCC_WARN_UNUSED_VARIABLE = YES; 376 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 377 | ONLY_ACTIVE_ARCH = YES; 378 | SDKROOT = iphoneos; 379 | TARGETED_DEVICE_FAMILY = "1,2"; 380 | }; 381 | name = Debug; 382 | }; 383 | CB028D6E1903E0660044B86F /* Release */ = { 384 | isa = XCBuildConfiguration; 385 | buildSettings = { 386 | ALWAYS_SEARCH_USER_PATHS = NO; 387 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 388 | CLANG_CXX_LIBRARY = "libc++"; 389 | CLANG_ENABLE_MODULES = YES; 390 | CLANG_ENABLE_OBJC_ARC = YES; 391 | CLANG_WARN_BOOL_CONVERSION = YES; 392 | CLANG_WARN_CONSTANT_CONVERSION = YES; 393 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 394 | CLANG_WARN_EMPTY_BODY = YES; 395 | CLANG_WARN_ENUM_CONVERSION = YES; 396 | CLANG_WARN_INT_CONVERSION = YES; 397 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 398 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 399 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 400 | COPY_PHASE_STRIP = YES; 401 | ENABLE_NS_ASSERTIONS = NO; 402 | GCC_C_LANGUAGE_STANDARD = gnu99; 403 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 404 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 405 | GCC_WARN_UNDECLARED_SELECTOR = YES; 406 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 407 | GCC_WARN_UNUSED_FUNCTION = YES; 408 | GCC_WARN_UNUSED_VARIABLE = YES; 409 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 410 | SDKROOT = iphoneos; 411 | TARGETED_DEVICE_FAMILY = "1,2"; 412 | VALIDATE_PRODUCT = YES; 413 | }; 414 | name = Release; 415 | }; 416 | CB028D701903E0660044B86F /* Debug */ = { 417 | isa = XCBuildConfiguration; 418 | buildSettings = { 419 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 420 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 421 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 422 | GCC_PREFIX_HEADER = "LazyFadeInView/LazyFadeInView-Prefix.pch"; 423 | INFOPLIST_FILE = "LazyFadeInView/LazyFadeInView-Info.plist"; 424 | PRODUCT_NAME = "$(TARGET_NAME)"; 425 | WRAPPER_EXTENSION = app; 426 | }; 427 | name = Debug; 428 | }; 429 | CB028D711903E0660044B86F /* Release */ = { 430 | isa = XCBuildConfiguration; 431 | buildSettings = { 432 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 433 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 434 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 435 | GCC_PREFIX_HEADER = "LazyFadeInView/LazyFadeInView-Prefix.pch"; 436 | INFOPLIST_FILE = "LazyFadeInView/LazyFadeInView-Info.plist"; 437 | PRODUCT_NAME = "$(TARGET_NAME)"; 438 | WRAPPER_EXTENSION = app; 439 | }; 440 | name = Release; 441 | }; 442 | CB028D731903E0660044B86F /* Debug */ = { 443 | isa = XCBuildConfiguration; 444 | buildSettings = { 445 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/LazyFadeInView.app/LazyFadeInView"; 446 | FRAMEWORK_SEARCH_PATHS = ( 447 | "$(SDKROOT)/Developer/Library/Frameworks", 448 | "$(inherited)", 449 | "$(DEVELOPER_FRAMEWORKS_DIR)", 450 | ); 451 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 452 | GCC_PREFIX_HEADER = "LazyFadeInView/LazyFadeInView-Prefix.pch"; 453 | GCC_PREPROCESSOR_DEFINITIONS = ( 454 | "DEBUG=1", 455 | "$(inherited)", 456 | ); 457 | INFOPLIST_FILE = "LazyFadeInViewTests/LazyFadeInViewTests-Info.plist"; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | TEST_HOST = "$(BUNDLE_LOADER)"; 460 | WRAPPER_EXTENSION = xctest; 461 | }; 462 | name = Debug; 463 | }; 464 | CB028D741903E0660044B86F /* Release */ = { 465 | isa = XCBuildConfiguration; 466 | buildSettings = { 467 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/LazyFadeInView.app/LazyFadeInView"; 468 | FRAMEWORK_SEARCH_PATHS = ( 469 | "$(SDKROOT)/Developer/Library/Frameworks", 470 | "$(inherited)", 471 | "$(DEVELOPER_FRAMEWORKS_DIR)", 472 | ); 473 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 474 | GCC_PREFIX_HEADER = "LazyFadeInView/LazyFadeInView-Prefix.pch"; 475 | INFOPLIST_FILE = "LazyFadeInViewTests/LazyFadeInViewTests-Info.plist"; 476 | PRODUCT_NAME = "$(TARGET_NAME)"; 477 | TEST_HOST = "$(BUNDLE_LOADER)"; 478 | WRAPPER_EXTENSION = xctest; 479 | }; 480 | name = Release; 481 | }; 482 | /* End XCBuildConfiguration section */ 483 | 484 | /* Begin XCConfigurationList section */ 485 | CB028D351903E0660044B86F /* Build configuration list for PBXProject "LazyFadeInView" */ = { 486 | isa = XCConfigurationList; 487 | buildConfigurations = ( 488 | CB028D6D1903E0660044B86F /* Debug */, 489 | CB028D6E1903E0660044B86F /* Release */, 490 | ); 491 | defaultConfigurationIsVisible = 0; 492 | defaultConfigurationName = Release; 493 | }; 494 | CB028D6F1903E0660044B86F /* Build configuration list for PBXNativeTarget "LazyFadeInView" */ = { 495 | isa = XCConfigurationList; 496 | buildConfigurations = ( 497 | CB028D701903E0660044B86F /* Debug */, 498 | CB028D711903E0660044B86F /* Release */, 499 | ); 500 | defaultConfigurationIsVisible = 0; 501 | defaultConfigurationName = Release; 502 | }; 503 | CB028D721903E0660044B86F /* Build configuration list for PBXNativeTarget "LazyFadeInViewTests" */ = { 504 | isa = XCConfigurationList; 505 | buildConfigurations = ( 506 | CB028D731903E0660044B86F /* Debug */, 507 | CB028D741903E0660044B86F /* Release */, 508 | ); 509 | defaultConfigurationIsVisible = 0; 510 | defaultConfigurationName = Release; 511 | }; 512 | /* End XCConfigurationList section */ 513 | }; 514 | rootObject = CB028D321903E0660044B86F /* Project object */; 515 | } 516 | -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/project.xcworkspace/xcshareddata/LazyFadeInView.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | DC60DEAF-BAA1-4672-B061-3BDF98AF8808 9 | IDESourceControlProjectName 10 | LazyFadeInView 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 0048F451FE29898BDA962084F24F1FCE88EE82CF 14 | https://github.com/itouch2/LazyFadeInView.git 15 | 16 | IDESourceControlProjectPath 17 | LazyFadeInView.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 0048F451FE29898BDA962084F24F1FCE88EE82CF 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/itouch2/LazyFadeInView.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 0048F451FE29898BDA962084F24F1FCE88EE82CF 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 0048F451FE29898BDA962084F24F1FCE88EE82CF 36 | IDESourceControlWCCName 37 | LazyFadeInView 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/project.xcworkspace/xcuserdata/Chandler.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itouch2/LazyFadeInView/8ac594b97addda1618fe8334102406f1f603c17c/LazyFadeInView.xcodeproj/project.xcworkspace/xcuserdata/Chandler.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/project.xcworkspace/xcuserdata/hewenjun.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itouch2/LazyFadeInView/8ac594b97addda1618fe8334102406f1f603c17c/LazyFadeInView.xcodeproj/project.xcworkspace/xcuserdata/hewenjun.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/project.xcworkspace/xcuserdata/hpcc.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itouch2/LazyFadeInView/8ac594b97addda1618fe8334102406f1f603c17c/LazyFadeInView.xcodeproj/project.xcworkspace/xcuserdata/hpcc.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/project.xcworkspace/xcuserdata/hpcc.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/xcshareddata/xcschemes/LazyFadeInView.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 | -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/xcuserdata/Chandler.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/xcuserdata/Chandler.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LazyFadeInView.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | CB028D391903E0660044B86F 16 | 17 | primary 18 | 19 | 20 | CB028D5D1903E0660044B86F 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/xcuserdata/hewenjun.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/xcuserdata/hewenjun.xcuserdatad/xcschemes/LazyFadeInView.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 | -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/xcuserdata/hewenjun.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LazyFadeInView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | CB028D391903E0660044B86F 16 | 17 | primary 18 | 19 | 20 | CB028D5D1903E0660044B86F 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/xcuserdata/hpcc.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/xcuserdata/hpcc.xcuserdatad/xcschemes/LazyFadeInView.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 | -------------------------------------------------------------------------------- /LazyFadeInView.xcodeproj/xcuserdata/hpcc.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LazyFadeInView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | CB028D391903E0660044B86F 16 | 17 | primary 18 | 19 | 20 | CB028D5D1903E0660044B86F 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /LazyFadeInView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LazyFadeInView 4 | // 5 | // Created by Tu You on 14-4-20. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /LazyFadeInView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LazyFadeInView 4 | // 5 | // Created by Tu You on 14-4-20. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | [application setStatusBarStyle:UIStatusBarStyleLightContent]; 17 | return YES; 18 | } 19 | 20 | - (void)applicationWillResignActive:(UIApplication *)application 21 | { 22 | // 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. 23 | // 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. 24 | } 25 | 26 | - (void)applicationDidEnterBackground:(UIApplication *)application 27 | { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | - (void)applicationWillEnterForeground:(UIApplication *)application 33 | { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application 38 | { 39 | // 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. 40 | } 41 | 42 | - (void)applicationWillTerminate:(UIApplication *)application 43 | { 44 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /LazyFadeInView/Base.lproj/Main_iPad.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 | -------------------------------------------------------------------------------- /LazyFadeInView/Base.lproj/Main_iPhone.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /LazyFadeInView/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 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /LazyFadeInView/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 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /LazyFadeInView/LazyFadeInView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | COM.TUYOU.${PRODUCT_NAME:rfc1034identifier} 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 | Main_iPhone 29 | UIMainStoryboardFile 30 | Main_iPhone 31 | UIMainStoryboardFile~ipad 32 | Main_iPad 33 | UIRequiredDeviceCapabilities 34 | 35 | armv7 36 | 37 | UISupportedInterfaceOrientations 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationLandscapeLeft 41 | UIInterfaceOrientationLandscapeRight 42 | 43 | UISupportedInterfaceOrientations~ipad 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationPortraitUpsideDown 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | UIViewControllerBasedStatusBarAppearance 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /LazyFadeInView/LazyFadeInView-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_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /LazyFadeInView/LazyFadeInView/LazyFadeIn.h: -------------------------------------------------------------------------------- 1 | // 2 | // LazyFadeIn.h 3 | // LazyFadeInView 4 | // 5 | // Created by Tu You on 14-4-21. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol LazyFadeIn 12 | 13 | //! @abstract The number of layers lazy loading. Defaults to 6. 14 | @property (assign, nonatomic, readwrite) NSUInteger numberOfLayers; 15 | 16 | //! @abstract The interval of layers fading. Defaults to 0.03 17 | @property (assign, nonatomic, readwrite) CFTimeInterval interval; 18 | 19 | //! @abstract The font of text. Defaults to [UIFont fontWithName:@"HelveticaNeue-Light" size:20.0f] 20 | @property (strong, nonatomic, readwrite) UIFont *textFont; 21 | 22 | //! @abstract The color of text. Defaults to white color 23 | @property (strong, nonatomic, readwrite) UIColor *textColor; 24 | 25 | //! @abstract Text. Defaults to nil 26 | @property (strong, nonatomic, readwrite) NSString *text; 27 | 28 | //! @abstract The attributes of text. Defaults to nil. 29 | @property (strong, nonatomic, readwrite) NSDictionary *attributes; 30 | 31 | @end 32 | 33 | -------------------------------------------------------------------------------- /LazyFadeInView/LazyFadeInView/LazyFadeInLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // LazyFadeInLayer.h 3 | // LazyFadeInView 4 | // 5 | // Created by Tu You on 14-4-20. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LazyFadeIn.h" 11 | 12 | @interface LazyFadeInLayer : CATextLayer 13 | 14 | @property (weak, nonatomic) UIView *sourceView; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /LazyFadeInView/LazyFadeInView/LazyFadeInLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // LazyFadeInLayer.m 3 | // LazyFadeInView 4 | // 5 | // Created by Tu You on 14-4-20. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import "LazyFadeInLayer.h" 10 | #import 11 | #import "NSString+LFEmoji.h" 12 | 13 | #define LAYER_UPDATE_ANIMATION_MUTATOR(mutator,ctype,propertyName) \ 14 | - (void)mutator (ctype)propertyName \ 15 | { \ 16 | if (_##propertyName != propertyName) { \ 17 | _##propertyName = propertyName; \ 18 | [self _updateAnimation]; \ 19 | } \ 20 | } 21 | 22 | @interface LazyFadeInLayer () { 23 | BOOL _isAnimating; 24 | } 25 | 26 | @property (strong, nonatomic) CADisplayLink *displayLink; 27 | @property (strong, nonatomic) NSMutableArray *alphaArray; 28 | @property (strong, nonatomic) NSMutableAttributedString *attributedString; 29 | @property (strong, nonatomic) NSMutableAttributedString *animatingAttributedString; 30 | 31 | @property (strong, nonatomic) NSMutableArray *tmpArray; 32 | 33 | @property (assign, nonatomic) NSUInteger frameCount; 34 | 35 | @end 36 | 37 | @implementation LazyFadeInLayer 38 | 39 | @synthesize numberOfLayers = _numberOfLayers; 40 | @synthesize interval = _interval; 41 | @synthesize textColor = _textColor, textFont = _textFont; 42 | @synthesize text = _text, attributes = _attributes; 43 | 44 | - (instancetype)init 45 | { 46 | self = [super init]; 47 | if (self) { 48 | _numberOfLayers = 6; 49 | _interval = 0.03; 50 | _alphaArray = [NSMutableArray array]; 51 | _tmpArray = [NSMutableArray array]; 52 | _textFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:20.0f]; 53 | _textColor = [UIColor colorWithRed:0.24 green:0.48 blue:0.82 alpha:1]; 54 | 55 | self.contentsScale = [[UIScreen mainScreen] scale]; 56 | self.wrapped = YES; 57 | } 58 | return self; 59 | } 60 | 61 | LAYER_UPDATE_ANIMATION_MUTATOR(setNumberOfLayers:, NSUInteger, numberOfLayers) 62 | LAYER_UPDATE_ANIMATION_MUTATOR(setText:, NSString *, text) 63 | LAYER_UPDATE_ANIMATION_MUTATOR(setTextColor:, UIColor *, textColor) 64 | LAYER_UPDATE_ANIMATION_MUTATOR(setInterval:, CFTimeInterval, interval) 65 | LAYER_UPDATE_ANIMATION_MUTATOR(setTextFont:, UIFont *, textFont) 66 | LAYER_UPDATE_ANIMATION_MUTATOR(setAttributes:, NSDictionary *, attributes) 67 | 68 | - (BOOL)isAnimating 69 | { 70 | return _isAnimating; 71 | } 72 | 73 | - (void)_updateAnimation 74 | { 75 | if (_text && _text.length != 0) { 76 | if (self.isAnimating) { 77 | [self _stopAnimating]; 78 | } 79 | [self _startAnimating]; 80 | } else { 81 | if (self.isAnimating) { 82 | [self _stopAnimating]; 83 | } 84 | } 85 | } 86 | 87 | - (void)_handleParagraphStyle 88 | { 89 | id style = [_attributes objectForKey:(NSString *)kCTParagraphStyleAttributeName]; 90 | CTParagraphStyleRef paragraphStyle = (__bridge CTParagraphStyleRef)(style); 91 | if (paragraphStyle) { 92 | CTTextAlignment textAlignment = kCTTextAlignmentNatural; 93 | CTParagraphStyleGetValueForSpecifier(paragraphStyle, kCTParagraphStyleSpecifierAlignment, sizeof(textAlignment), &textAlignment); 94 | if (textAlignment == kCTTextAlignmentLeft) { 95 | self.alignmentMode = kCAAlignmentLeft; 96 | } else if (textAlignment == kCTTextAlignmentRight) { 97 | self.alignmentMode = kCAAlignmentRight; 98 | } else if (textAlignment == kCTTextAlignmentCenter) { 99 | self.alignmentMode = kCAAlignmentCenter; 100 | } else if (textAlignment == kCTTextAlignmentJustified) { 101 | self.alignmentMode = kCAAlignmentJustified; 102 | } else if (textAlignment == kCTTextAlignmentNatural) { 103 | self.alignmentMode = kCAAlignmentNatural; 104 | } 105 | } else { 106 | self.alignmentMode = kCAAlignmentNatural; 107 | } 108 | } 109 | 110 | - (void)_startAnimating 111 | { 112 | if (_text.length == 0) { 113 | return; 114 | } 115 | 116 | [self _setupAlphaArray]; 117 | 118 | self.attributedString = [[NSMutableAttributedString alloc] initWithString:_text attributes:_attributes]; 119 | [self.attributedString removeAttribute:(NSString *)kCTFontAttributeName range:NSMakeRange(0, _text.length)]; 120 | [self.attributedString removeAttribute:(NSString *)kCTForegroundColorAttributeName range:NSMakeRange(0, _text.length)]; 121 | 122 | //CATextLaye does not support NSParagraphStyleAttributeName or kCTParagraphStyleAttributeName 123 | [self _handleParagraphStyle]; 124 | 125 | CTFontRef fontRef = CTFontCreateWithName((__bridge CFStringRef)_textFont.fontName, _textFont.pointSize, NULL); 126 | [_attributedString addAttribute:(NSString *)kCTFontAttributeName 127 | value:(__bridge id)fontRef 128 | range:NSMakeRange(0, _text.length)]; 129 | [_attributedString addAttribute:(NSString *)kCTForegroundColorAttributeName value:(__bridge id)_textColor.CGColor range:NSMakeRange(0, _text.length)]; 130 | CFRelease(fontRef); 131 | 132 | _frameCount = 0; 133 | _animatingAttributedString = [[NSMutableAttributedString alloc] initWithAttributedString:_attributedString]; 134 | 135 | _isAnimating = YES; 136 | self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(_frameUpdate:)]; 137 | [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; 138 | } 139 | 140 | - (void)_stopAnimating 141 | { 142 | _isAnimating = NO; 143 | self.string = _attributedString; 144 | [_displayLink invalidate]; 145 | self.displayLink = nil; 146 | 147 | // notify the caller the animation has completed 148 | SEL animationDidEndSelector = NSSelectorFromString(@"lazyFadeInLayerAnimationDidEnd"); 149 | [self.sourceView performSelector:animationDidEndSelector withObject:nil afterDelay:0]; 150 | } 151 | 152 | - (void)_frameUpdate:(id)sender 153 | { 154 | _frameCount++; 155 | 156 | BOOL isFinished = YES; 157 | 158 | CGFloat toColorAlpha = 0.0f; 159 | CGFloat toColorR = 0.0f; 160 | CGFloat toColorG = 0.0f; 161 | CGFloat toColorB = 0.0f; 162 | 163 | [_textColor getRed:&toColorR green:&toColorG blue:&toColorB alpha:&toColorAlpha]; 164 | 165 | for (int i = 0; i < _text.length; ++i) { 166 | CGFloat currentColorAlpha = [_alphaArray[i] floatValue] + _frameCount * _interval; 167 | if (isFinished && currentColorAlpha < toColorAlpha) { 168 | isFinished = NO; 169 | } 170 | UIColor *currentColor = [UIColor colorWithRed:toColorR green:toColorG blue:toColorB alpha:currentColorAlpha]; 171 | [_animatingAttributedString addAttribute:(NSString *)kCTForegroundColorAttributeName 172 | value:(id)currentColor.CGColor 173 | range:NSMakeRange(i, 1)]; 174 | } 175 | 176 | if (isFinished) { 177 | [self _stopAnimating]; 178 | return; 179 | } 180 | 181 | self.string = (id)_animatingAttributedString; 182 | } 183 | 184 | - (void)_setupAlphaArray 185 | { 186 | if (!_text.length) { 187 | return; 188 | } 189 | 190 | if (_alphaArray.count) { 191 | if (_text.length != _alphaArray.count) { 192 | [self _resetAlphaArray]; 193 | } 194 | } else { 195 | [self _resetAlphaArray]; 196 | } 197 | } 198 | 199 | - (void)_resetAlphaArray 200 | { 201 | [_alphaArray removeAllObjects]; 202 | self.alphaArray = [NSMutableArray arrayWithCapacity:_text.length]; 203 | for (int i = 0; i < _text.length; ++i) { 204 | [_alphaArray addObject:@(MAXFLOAT)]; 205 | } 206 | 207 | [self _randomAlphaArray]; 208 | } 209 | 210 | - (void)_randomAlphaArray 211 | { 212 | if (!_text.length && _numberOfLayers <= 0) { 213 | return; 214 | } 215 | 216 | NSUInteger totalCount = _text.length; 217 | 218 | NSUInteger tTotalCount = totalCount + 1; 219 | [_tmpArray removeAllObjects]; 220 | _tmpArray = [NSMutableArray arrayWithCapacity:_numberOfLayers]; 221 | 222 | for (int i = 0; i < _numberOfLayers - 1; ++i) { 223 | int k = arc4random() % tTotalCount; 224 | [_tmpArray addObject:@(k)]; 225 | tTotalCount -= k; 226 | } 227 | [_tmpArray addObject:@(tTotalCount - 1)]; 228 | 229 | for (int i = 0; i < _tmpArray.count; ++i) { 230 | int count = [_tmpArray[i] intValue]; 231 | CGFloat alpha = -(i * 0.25); 232 | while (count) { 233 | int k = arc4random() % totalCount; 234 | if ([_alphaArray[k] floatValue] > 1) { 235 | if ([self charIsInEmojAtIndex:k]) { 236 | _alphaArray[k] = @(1); 237 | } else { 238 | _alphaArray[k] = @(alpha); 239 | } 240 | count--; 241 | } 242 | } 243 | } 244 | } 245 | 246 | - (BOOL)charIsInEmojAtIndex:(NSUInteger)index 247 | { 248 | NSArray *array = [self.text lf_emojiRanges]; 249 | __block BOOL isIn = NO; 250 | [array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { 251 | NSRange range = ((NSValue *)obj).rangeValue; 252 | if (index >= range.location && index < range.location + range.length) { 253 | isIn = YES; 254 | *stop = YES; 255 | } 256 | }]; 257 | return isIn; 258 | } 259 | 260 | @end 261 | 262 | -------------------------------------------------------------------------------- /LazyFadeInView/LazyFadeInView/LazyFadeInView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LazyFadeInView.h 3 | // LazyFadeInView 4 | // 5 | // Created by Tu You on 14-4-20. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LazyFadeIn.h" 11 | 12 | @class LazyFadeInView; 13 | 14 | @protocol LazyFadeInViewDelegate 15 | 16 | @optional 17 | - (void)fadeInAnimationDidEnd:(LazyFadeInView *)fadeInView; 18 | 19 | @end 20 | 21 | @interface LazyFadeInView : UIView 22 | 23 | @property (weak, nonatomic) id delegate; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /LazyFadeInView/LazyFadeInView/LazyFadeInView.m: -------------------------------------------------------------------------------- 1 | // 2 | // LazyFadeInView.m 3 | // LazyFadeInView 4 | // 5 | // Created by Tu You on 14-4-20. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import "LazyFadeInView.h" 10 | #import "LazyFadeInLayer.h" 11 | 12 | #define __layer ((LazyFadeInLayer *)self.layer) 13 | 14 | #define LAYER_ACCESSOR(accessor, ctype) \ 15 | - (ctype)accessor { \ 16 | return [__layer accessor]; \ 17 | } 18 | 19 | #define LAYER_MUTATOR(mutator, ctype) \ 20 | - (void)mutator (ctype)value { \ 21 | [__layer mutator value]; \ 22 | } 23 | 24 | #define LAYER_RW_PROPERTY(accessor, mutator, ctype) \ 25 | LAYER_ACCESSOR (accessor, ctype) \ 26 | LAYER_MUTATOR (mutator, ctype) 27 | 28 | @implementation LazyFadeInView 29 | 30 | LAYER_RW_PROPERTY(numberOfLayers, setNumberOfLayers:, NSUInteger) 31 | LAYER_RW_PROPERTY(interval, setInterval:, CFTimeInterval) 32 | LAYER_RW_PROPERTY(textFont, setTextFont:, UIFont *) 33 | LAYER_RW_PROPERTY(textColor, setTextColor:, UIColor *) 34 | LAYER_RW_PROPERTY(text, setText:, NSString *) 35 | LAYER_RW_PROPERTY(attributes, setAttributes:, NSDictionary *) 36 | 37 | + (Class)layerClass 38 | { 39 | return [LazyFadeInLayer class]; 40 | } 41 | 42 | - (instancetype)initWithCoder:(NSCoder *)aDecoder 43 | { 44 | if (self = [super initWithCoder:aDecoder]) { 45 | [self commonInit]; 46 | } 47 | return self; 48 | } 49 | 50 | - (instancetype)initWithFrame:(CGRect)frame 51 | { 52 | self = [super initWithFrame:frame]; 53 | if (self) { 54 | [self commonInit]; 55 | } 56 | return self; 57 | } 58 | 59 | - (void)commonInit 60 | { 61 | self.backgroundColor = [UIColor clearColor]; 62 | self.layer.contentsScale = [UIScreen mainScreen].scale; 63 | ((LazyFadeInLayer *)self.layer).sourceView = self; 64 | } 65 | 66 | - (void)lazyFadeInLayerAnimationDidEnd 67 | { 68 | if ([self.delegate respondsToSelector:@selector(fadeInAnimationDidEnd:)]) { 69 | [self.delegate fadeInAnimationDidEnd:self]; 70 | } 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /LazyFadeInView/LazyFadeInView/NSString+LFEmoji.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+LFEmoji.h 3 | // LazyFadeInView 4 | // 5 | // Created by You Tu on 16/2/29. 6 | // Copyright © 2016年 Tu You. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (LFEmoji) 12 | 13 | - (NSArray *)lf_emojiRanges; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /LazyFadeInView/LazyFadeInView/NSString+LFEmoji.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+LFEmoji.m 3 | // LazyFadeInView 4 | // 5 | // Created by You Tu on 16/2/29. 6 | // Copyright © 2016年 Tu You. All rights reserved. 7 | // 8 | 9 | #import "NSString+LFEmoji.h" 10 | 11 | @implementation NSString (LFEmoji) 12 | 13 | - (NSArray *)lf_emojiRanges 14 | { 15 | __block NSMutableArray *emojiRangesArray = [NSMutableArray new]; 16 | 17 | [self enumerateSubstringsInRange:NSMakeRange(0, 18 | [self length]) 19 | options:NSStringEnumerationByComposedCharacterSequences 20 | usingBlock:^(NSString *substring, 21 | NSRange substringRange, 22 | NSRange enclosingRange, 23 | BOOL *stop) { 24 | const unichar hs = [substring characterAtIndex:0]; 25 | // surrogate pair 26 | if (0xd800 <= hs && hs <= 0xdbff) { 27 | if (substring.length > 1) { 28 | const unichar ls = [substring characterAtIndex:1]; 29 | const int uc = ((hs - 0xd800) * 0x400) + (ls - 0xdc00) + 0x10000; 30 | if (0x1d000 <= uc && uc <= 0x1f9c0) { 31 | [emojiRangesArray addObject:[NSValue valueWithRange:substringRange]]; 32 | } 33 | } 34 | } else if (substring.length > 1) { 35 | const unichar ls = [substring characterAtIndex:1]; 36 | if (ls == 0x20e3 || ls == 0xfe0f || ls == 0xd83c) { 37 | [emojiRangesArray addObject:[NSValue valueWithRange:substringRange]]; 38 | } 39 | } else { 40 | // non surrogate 41 | if (0x2100 <= hs && hs <= 0x27ff) { 42 | [emojiRangesArray addObject:[NSValue valueWithRange:substringRange]]; 43 | } else if (0x2B05 <= hs && hs <= 0x2b07) { 44 | [emojiRangesArray addObject:[NSValue valueWithRange:substringRange]]; 45 | } else if (0x2934 <= hs && hs <= 0x2935) { 46 | [emojiRangesArray addObject:[NSValue valueWithRange:substringRange]]; 47 | } else if (0x3297 <= hs && hs <= 0x3299) { 48 | [emojiRangesArray addObject:[NSValue valueWithRange:substringRange]]; 49 | } else if (hs == 0xa9 || hs == 0xae || hs == 0x303d || hs == 0x3030 || hs == 0x2b55 || hs == 0x2b1c || hs == 0x2b1b || hs == 0x2b50) { 50 | [emojiRangesArray addObject:[NSValue valueWithRange:substringRange]]; 51 | } 52 | } 53 | }]; 54 | 55 | return emojiRangesArray; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /LazyFadeInView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LazyFadeInView 4 | // 5 | // Created by Tu You on 14-4-20. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LazyFadeInView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LazyFadeInView 4 | // 5 | // Created by Tu You on 14-4-20. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "LazyFadeInView.h" 11 | 12 | static NSString * const kStrayBirds = @"Stray birds of summer come to my window to sing and fly away. And yellow leaves of autumn, which have no songs, flutter and fall there with a sign. O Troupe of little vagrants of the world, leave your footprints in my words."; 13 | 14 | static NSString * const kQianChiBiFu = @"😝😝😝😝😝😝😝😝😝😝😝😝😝😝惟江上之清风,与山间之明月,耳得之而为声,目遇之而成色。取之无禁,用之不竭。是造物者之无尽藏也,而吾与子之所共适。"; 15 | 16 | @interface ViewController () 17 | 18 | @property (strong, nonatomic) LazyFadeInView *fadeInView; 19 | @property (assign, nonatomic) BOOL flag; 20 | 21 | @end 22 | 23 | @implementation ViewController 24 | 25 | - (void)viewDidLoad 26 | { 27 | [super viewDidLoad]; 28 | 29 | CGFloat screenWidth = CGRectGetWidth([UIScreen mainScreen].bounds); 30 | LazyFadeInView *fade = [[LazyFadeInView alloc] initWithFrame:CGRectMake(20, 100, screenWidth - 40, 200)]; 31 | fade.delegate = self; 32 | fade.textColor = [UIColor whiteColor]; 33 | fade.text = kStrayBirds; 34 | [self.view addSubview:fade]; 35 | self.view.backgroundColor = [UIColor blackColor]; 36 | self.fadeInView = fade; 37 | } 38 | 39 | - (void)fadeInAnimationDidEnd:(LazyFadeInView *)fadeInView 40 | { 41 | NSLog(@"%@ fade in animation completed.", fadeInView); 42 | } 43 | 44 | - (IBAction)setTextBtnClicked:(id)sender 45 | { 46 | if (self.flag) { 47 | self.fadeInView.text = kStrayBirds; 48 | } else { 49 | self.fadeInView.text = kQianChiBiFu; 50 | } 51 | self.flag = !self.flag; 52 | } 53 | 54 | - (IBAction)colorSwitched:(id)sender 55 | { 56 | if (((UISwitch *)sender).on == YES) { 57 | self.view.backgroundColor = [UIColor colorWithRed:0.24 green:0.48 blue:0.82 alpha:1]; 58 | } else { 59 | self.view.backgroundColor = [UIColor blackColor]; 60 | } 61 | } 62 | 63 | - (void)didReceiveMemoryWarning 64 | { 65 | [super didReceiveMemoryWarning]; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /LazyFadeInView/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LazyFadeInView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LazyFadeInView 4 | // 5 | // Created by Tu You on 14-4-20. 6 | // Copyright (c) 2014年 Tu You. 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 | -------------------------------------------------------------------------------- /LazyFadeInViewTests/LazyFadeInViewTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | COM.TUYOU.${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 | -------------------------------------------------------------------------------- /LazyFadeInViewTests/LazyFadeInViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LazyFadeInViewTests.m 3 | // LazyFadeInViewTests 4 | // 5 | // Created by Tu You on 14-4-20. 6 | // Copyright (c) 2014年 Tu You. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LazyFadeInViewTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LazyFadeInViewTests 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 | // This is an example of a functional test case. 32 | XCTAssert(YES, @"Pass"); 33 | } 34 | @end 35 | -------------------------------------------------------------------------------- /LazyFadeInViewTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LazyFadeInView 2 | LazyFadeInView is a cool way to animate the appearance of a label. This effect is a clone of [Secret app](https://itunes.apple.com/us/app/secret-speak-freely/id775307543?mt=8). You can find Swift version in [here](https://github.com/itouch2/LazyFadeInView-Swift/) 3 | 4 | [![Build Status](https://travis-ci.org/itouch2/LazyFadeInView.svg)](https://travis-ci.org/itouch2/LazyFadeInView) 5 | [![Pod Version](http://img.shields.io/cocoapods/v/LazyFadeInView.svg?style=flat)](http://cocoapods.org/?q=LazyFadeInView) 6 | [![Platform](http://img.shields.io/cocoapods/p/LazyFadeInView.svg?style=flat)](http://cocoapods.org/?q=LazyFadeInView) 7 | [![License](http://img.shields.io/cocoapods/l/LazyFadeInView.svg?style=flat)](https://github.com/itouch2/LazyFadeInView/blob/master/LICENSE) 8 | 9 | 10 | ## Usage 11 | To use LazyFadeInView, create a `LazyFadeInView` and add it to your view. It will animate to show up once it's text is set. 12 | 13 | An example of making a lazy fade in view: 14 | 15 | ```objective-c 16 | LazyFadeInView *fadeInView = [[LazyFadeInView alloc] initWithFrame:CGRectMake(20, 120, 280, 200)]; 17 | self.fadeInView.text = @"Stray birds of summer come to my window to sing and fly away."; 18 | self.fadeInView.textColor = [UIColor whiteColor]; 19 | [self.view addSubview:self.fadeInView]; 20 | ``` 21 | 22 | ## Podfile 23 | 24 | [CocosPods](http://cocosPods.org) is the recommended method to install LazyFadeInView, just add the following line to `Podfile` 25 | 26 | ``` 27 | pod 'LazyFadeInView', '~> 1.0.0' 28 | ``` 29 | 30 | and run `pod install`, then you're all done! 31 | 32 | ## A Quick Peek 33 | ![screenshots](https://cloud.githubusercontent.com/assets/4316898/2808172/95280184-cd14-11e3-876b-ac00ba78fbc9.gif) 34 | 35 | ## License 36 | 37 | LazyFadeInView is available under the MIT license, see the LICENSE file for more information. 38 | --------------------------------------------------------------------------------