├── LBScrollLabelDemo ├── LBScrollLabelDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── LBScrollLabelDemo.xccheckout │ └── xcuserdata │ │ └── luohuichao.xcuserdatad │ │ └── xcschemes │ │ ├── LBScrollLabelDemo.xcscheme │ │ └── xcschememanagement.plist ├── LBScrollLabelDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── LBScorllLabel │ │ ├── LBScrollLabel.h │ │ └── LBScrollLabel.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m └── LBScrollLabelDemoTests │ ├── Info.plist │ └── LBScrollLabelDemoTests.m └── README.md /LBScrollLabelDemo/LBScrollLabelDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1A7CE1061BB9159F00E286D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CE1051BB9159F00E286D0 /* main.m */; }; 11 | 1A7CE1091BB9159F00E286D0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CE1081BB9159F00E286D0 /* AppDelegate.m */; }; 12 | 1A7CE10C1BB9159F00E286D0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CE10B1BB9159F00E286D0 /* ViewController.m */; }; 13 | 1A7CE10F1BB9159F00E286D0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CE10D1BB9159F00E286D0 /* Main.storyboard */; }; 14 | 1A7CE1111BB9159F00E286D0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CE1101BB9159F00E286D0 /* Images.xcassets */; }; 15 | 1A7CE1141BB9159F00E286D0 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CE1121BB9159F00E286D0 /* LaunchScreen.xib */; }; 16 | 1A7CE1201BB9159F00E286D0 /* LBScrollLabelDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CE11F1BB9159F00E286D0 /* LBScrollLabelDemoTests.m */; }; 17 | 1A7CE12C1BB9175C00E286D0 /* LBScrollLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CE12B1BB9175C00E286D0 /* LBScrollLabel.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 1A7CE11A1BB9159F00E286D0 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 1A7CE0F81BB9159F00E286D0 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 1A7CE0FF1BB9159F00E286D0; 26 | remoteInfo = LBScrollLabelDemo; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 1A7CE1001BB9159F00E286D0 /* LBScrollLabelDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LBScrollLabelDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | 1A7CE1041BB9159F00E286D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | 1A7CE1051BB9159F00E286D0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | 1A7CE1071BB9159F00E286D0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 35 | 1A7CE1081BB9159F00E286D0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 36 | 1A7CE10A1BB9159F00E286D0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 37 | 1A7CE10B1BB9159F00E286D0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 38 | 1A7CE10E1BB9159F00E286D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | 1A7CE1101BB9159F00E286D0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | 1A7CE1131BB9159F00E286D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 41 | 1A7CE1191BB9159F00E286D0 /* LBScrollLabelDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LBScrollLabelDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 1A7CE11E1BB9159F00E286D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | 1A7CE11F1BB9159F00E286D0 /* LBScrollLabelDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LBScrollLabelDemoTests.m; sourceTree = ""; }; 44 | 1A7CE12A1BB9175C00E286D0 /* LBScrollLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LBScrollLabel.h; sourceTree = ""; }; 45 | 1A7CE12B1BB9175C00E286D0 /* LBScrollLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LBScrollLabel.m; sourceTree = ""; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | 1A7CE0FD1BB9159F00E286D0 /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | 1A7CE1161BB9159F00E286D0 /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | 1A7CE0F71BB9159F00E286D0 = { 67 | isa = PBXGroup; 68 | children = ( 69 | 1A7CE1021BB9159F00E286D0 /* LBScrollLabelDemo */, 70 | 1A7CE11C1BB9159F00E286D0 /* LBScrollLabelDemoTests */, 71 | 1A7CE1011BB9159F00E286D0 /* Products */, 72 | ); 73 | sourceTree = ""; 74 | }; 75 | 1A7CE1011BB9159F00E286D0 /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 1A7CE1001BB9159F00E286D0 /* LBScrollLabelDemo.app */, 79 | 1A7CE1191BB9159F00E286D0 /* LBScrollLabelDemoTests.xctest */, 80 | ); 81 | name = Products; 82 | sourceTree = ""; 83 | }; 84 | 1A7CE1021BB9159F00E286D0 /* LBScrollLabelDemo */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 1A7CE1291BB916B800E286D0 /* LBScorllLabel */, 88 | 1A7CE1071BB9159F00E286D0 /* AppDelegate.h */, 89 | 1A7CE1081BB9159F00E286D0 /* AppDelegate.m */, 90 | 1A7CE10A1BB9159F00E286D0 /* ViewController.h */, 91 | 1A7CE10B1BB9159F00E286D0 /* ViewController.m */, 92 | 1A7CE10D1BB9159F00E286D0 /* Main.storyboard */, 93 | 1A7CE1101BB9159F00E286D0 /* Images.xcassets */, 94 | 1A7CE1121BB9159F00E286D0 /* LaunchScreen.xib */, 95 | 1A7CE1031BB9159F00E286D0 /* Supporting Files */, 96 | ); 97 | path = LBScrollLabelDemo; 98 | sourceTree = ""; 99 | }; 100 | 1A7CE1031BB9159F00E286D0 /* Supporting Files */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 1A7CE1041BB9159F00E286D0 /* Info.plist */, 104 | 1A7CE1051BB9159F00E286D0 /* main.m */, 105 | ); 106 | name = "Supporting Files"; 107 | sourceTree = ""; 108 | }; 109 | 1A7CE11C1BB9159F00E286D0 /* LBScrollLabelDemoTests */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 1A7CE11F1BB9159F00E286D0 /* LBScrollLabelDemoTests.m */, 113 | 1A7CE11D1BB9159F00E286D0 /* Supporting Files */, 114 | ); 115 | path = LBScrollLabelDemoTests; 116 | sourceTree = ""; 117 | }; 118 | 1A7CE11D1BB9159F00E286D0 /* Supporting Files */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 1A7CE11E1BB9159F00E286D0 /* Info.plist */, 122 | ); 123 | name = "Supporting Files"; 124 | sourceTree = ""; 125 | }; 126 | 1A7CE1291BB916B800E286D0 /* LBScorllLabel */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 1A7CE12A1BB9175C00E286D0 /* LBScrollLabel.h */, 130 | 1A7CE12B1BB9175C00E286D0 /* LBScrollLabel.m */, 131 | ); 132 | path = LBScorllLabel; 133 | sourceTree = ""; 134 | }; 135 | /* End PBXGroup section */ 136 | 137 | /* Begin PBXNativeTarget section */ 138 | 1A7CE0FF1BB9159F00E286D0 /* LBScrollLabelDemo */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = 1A7CE1231BB9159F00E286D0 /* Build configuration list for PBXNativeTarget "LBScrollLabelDemo" */; 141 | buildPhases = ( 142 | 1A7CE0FC1BB9159F00E286D0 /* Sources */, 143 | 1A7CE0FD1BB9159F00E286D0 /* Frameworks */, 144 | 1A7CE0FE1BB9159F00E286D0 /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | ); 150 | name = LBScrollLabelDemo; 151 | productName = LBScrollLabelDemo; 152 | productReference = 1A7CE1001BB9159F00E286D0 /* LBScrollLabelDemo.app */; 153 | productType = "com.apple.product-type.application"; 154 | }; 155 | 1A7CE1181BB9159F00E286D0 /* LBScrollLabelDemoTests */ = { 156 | isa = PBXNativeTarget; 157 | buildConfigurationList = 1A7CE1261BB9159F00E286D0 /* Build configuration list for PBXNativeTarget "LBScrollLabelDemoTests" */; 158 | buildPhases = ( 159 | 1A7CE1151BB9159F00E286D0 /* Sources */, 160 | 1A7CE1161BB9159F00E286D0 /* Frameworks */, 161 | 1A7CE1171BB9159F00E286D0 /* Resources */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | 1A7CE11B1BB9159F00E286D0 /* PBXTargetDependency */, 167 | ); 168 | name = LBScrollLabelDemoTests; 169 | productName = LBScrollLabelDemoTests; 170 | productReference = 1A7CE1191BB9159F00E286D0 /* LBScrollLabelDemoTests.xctest */; 171 | productType = "com.apple.product-type.bundle.unit-test"; 172 | }; 173 | /* End PBXNativeTarget section */ 174 | 175 | /* Begin PBXProject section */ 176 | 1A7CE0F81BB9159F00E286D0 /* Project object */ = { 177 | isa = PBXProject; 178 | attributes = { 179 | CLASSPREFIX = LB; 180 | LastUpgradeCheck = 0640; 181 | ORGANIZATIONNAME = luobbe; 182 | TargetAttributes = { 183 | 1A7CE0FF1BB9159F00E286D0 = { 184 | CreatedOnToolsVersion = 6.4; 185 | }; 186 | 1A7CE1181BB9159F00E286D0 = { 187 | CreatedOnToolsVersion = 6.4; 188 | TestTargetID = 1A7CE0FF1BB9159F00E286D0; 189 | }; 190 | }; 191 | }; 192 | buildConfigurationList = 1A7CE0FB1BB9159F00E286D0 /* Build configuration list for PBXProject "LBScrollLabelDemo" */; 193 | compatibilityVersion = "Xcode 3.2"; 194 | developmentRegion = English; 195 | hasScannedForEncodings = 0; 196 | knownRegions = ( 197 | en, 198 | Base, 199 | ); 200 | mainGroup = 1A7CE0F71BB9159F00E286D0; 201 | productRefGroup = 1A7CE1011BB9159F00E286D0 /* Products */; 202 | projectDirPath = ""; 203 | projectRoot = ""; 204 | targets = ( 205 | 1A7CE0FF1BB9159F00E286D0 /* LBScrollLabelDemo */, 206 | 1A7CE1181BB9159F00E286D0 /* LBScrollLabelDemoTests */, 207 | ); 208 | }; 209 | /* End PBXProject section */ 210 | 211 | /* Begin PBXResourcesBuildPhase section */ 212 | 1A7CE0FE1BB9159F00E286D0 /* Resources */ = { 213 | isa = PBXResourcesBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | 1A7CE10F1BB9159F00E286D0 /* Main.storyboard in Resources */, 217 | 1A7CE1141BB9159F00E286D0 /* LaunchScreen.xib in Resources */, 218 | 1A7CE1111BB9159F00E286D0 /* Images.xcassets in Resources */, 219 | ); 220 | runOnlyForDeploymentPostprocessing = 0; 221 | }; 222 | 1A7CE1171BB9159F00E286D0 /* Resources */ = { 223 | isa = PBXResourcesBuildPhase; 224 | buildActionMask = 2147483647; 225 | files = ( 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | }; 229 | /* End PBXResourcesBuildPhase section */ 230 | 231 | /* Begin PBXSourcesBuildPhase section */ 232 | 1A7CE0FC1BB9159F00E286D0 /* Sources */ = { 233 | isa = PBXSourcesBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | 1A7CE10C1BB9159F00E286D0 /* ViewController.m in Sources */, 237 | 1A7CE1091BB9159F00E286D0 /* AppDelegate.m in Sources */, 238 | 1A7CE1061BB9159F00E286D0 /* main.m in Sources */, 239 | 1A7CE12C1BB9175C00E286D0 /* LBScrollLabel.m in Sources */, 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | }; 243 | 1A7CE1151BB9159F00E286D0 /* Sources */ = { 244 | isa = PBXSourcesBuildPhase; 245 | buildActionMask = 2147483647; 246 | files = ( 247 | 1A7CE1201BB9159F00E286D0 /* LBScrollLabelDemoTests.m in Sources */, 248 | ); 249 | runOnlyForDeploymentPostprocessing = 0; 250 | }; 251 | /* End PBXSourcesBuildPhase section */ 252 | 253 | /* Begin PBXTargetDependency section */ 254 | 1A7CE11B1BB9159F00E286D0 /* PBXTargetDependency */ = { 255 | isa = PBXTargetDependency; 256 | target = 1A7CE0FF1BB9159F00E286D0 /* LBScrollLabelDemo */; 257 | targetProxy = 1A7CE11A1BB9159F00E286D0 /* PBXContainerItemProxy */; 258 | }; 259 | /* End PBXTargetDependency section */ 260 | 261 | /* Begin PBXVariantGroup section */ 262 | 1A7CE10D1BB9159F00E286D0 /* Main.storyboard */ = { 263 | isa = PBXVariantGroup; 264 | children = ( 265 | 1A7CE10E1BB9159F00E286D0 /* Base */, 266 | ); 267 | name = Main.storyboard; 268 | sourceTree = ""; 269 | }; 270 | 1A7CE1121BB9159F00E286D0 /* LaunchScreen.xib */ = { 271 | isa = PBXVariantGroup; 272 | children = ( 273 | 1A7CE1131BB9159F00E286D0 /* Base */, 274 | ); 275 | name = LaunchScreen.xib; 276 | sourceTree = ""; 277 | }; 278 | /* End PBXVariantGroup section */ 279 | 280 | /* Begin XCBuildConfiguration section */ 281 | 1A7CE1211BB9159F00E286D0 /* Debug */ = { 282 | isa = XCBuildConfiguration; 283 | buildSettings = { 284 | ALWAYS_SEARCH_USER_PATHS = NO; 285 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 286 | CLANG_CXX_LIBRARY = "libc++"; 287 | CLANG_ENABLE_MODULES = YES; 288 | CLANG_ENABLE_OBJC_ARC = YES; 289 | CLANG_WARN_BOOL_CONVERSION = YES; 290 | CLANG_WARN_CONSTANT_CONVERSION = YES; 291 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 292 | CLANG_WARN_EMPTY_BODY = YES; 293 | CLANG_WARN_ENUM_CONVERSION = YES; 294 | CLANG_WARN_INT_CONVERSION = YES; 295 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 296 | CLANG_WARN_UNREACHABLE_CODE = YES; 297 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 298 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 299 | COPY_PHASE_STRIP = NO; 300 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 301 | ENABLE_STRICT_OBJC_MSGSEND = YES; 302 | GCC_C_LANGUAGE_STANDARD = gnu99; 303 | GCC_DYNAMIC_NO_PIC = NO; 304 | GCC_NO_COMMON_BLOCKS = YES; 305 | GCC_OPTIMIZATION_LEVEL = 0; 306 | GCC_PREPROCESSOR_DEFINITIONS = ( 307 | "DEBUG=1", 308 | "$(inherited)", 309 | ); 310 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 311 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 312 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 313 | GCC_WARN_UNDECLARED_SELECTOR = YES; 314 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 315 | GCC_WARN_UNUSED_FUNCTION = YES; 316 | GCC_WARN_UNUSED_VARIABLE = YES; 317 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 318 | MTL_ENABLE_DEBUG_INFO = YES; 319 | ONLY_ACTIVE_ARCH = YES; 320 | SDKROOT = iphoneos; 321 | }; 322 | name = Debug; 323 | }; 324 | 1A7CE1221BB9159F00E286D0 /* Release */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 329 | CLANG_CXX_LIBRARY = "libc++"; 330 | CLANG_ENABLE_MODULES = YES; 331 | CLANG_ENABLE_OBJC_ARC = YES; 332 | CLANG_WARN_BOOL_CONVERSION = YES; 333 | CLANG_WARN_CONSTANT_CONVERSION = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INT_CONVERSION = YES; 338 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 339 | CLANG_WARN_UNREACHABLE_CODE = YES; 340 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 341 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 342 | COPY_PHASE_STRIP = NO; 343 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 344 | ENABLE_NS_ASSERTIONS = NO; 345 | ENABLE_STRICT_OBJC_MSGSEND = YES; 346 | GCC_C_LANGUAGE_STANDARD = gnu99; 347 | GCC_NO_COMMON_BLOCKS = YES; 348 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 349 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 350 | GCC_WARN_UNDECLARED_SELECTOR = YES; 351 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 352 | GCC_WARN_UNUSED_FUNCTION = YES; 353 | GCC_WARN_UNUSED_VARIABLE = YES; 354 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 355 | MTL_ENABLE_DEBUG_INFO = NO; 356 | SDKROOT = iphoneos; 357 | VALIDATE_PRODUCT = YES; 358 | }; 359 | name = Release; 360 | }; 361 | 1A7CE1241BB9159F00E286D0 /* Debug */ = { 362 | isa = XCBuildConfiguration; 363 | buildSettings = { 364 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 365 | INFOPLIST_FILE = LBScrollLabelDemo/Info.plist; 366 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 367 | PRODUCT_NAME = "$(TARGET_NAME)"; 368 | }; 369 | name = Debug; 370 | }; 371 | 1A7CE1251BB9159F00E286D0 /* Release */ = { 372 | isa = XCBuildConfiguration; 373 | buildSettings = { 374 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 375 | INFOPLIST_FILE = LBScrollLabelDemo/Info.plist; 376 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 377 | PRODUCT_NAME = "$(TARGET_NAME)"; 378 | }; 379 | name = Release; 380 | }; 381 | 1A7CE1271BB9159F00E286D0 /* Debug */ = { 382 | isa = XCBuildConfiguration; 383 | buildSettings = { 384 | BUNDLE_LOADER = "$(TEST_HOST)"; 385 | FRAMEWORK_SEARCH_PATHS = ( 386 | "$(SDKROOT)/Developer/Library/Frameworks", 387 | "$(inherited)", 388 | ); 389 | GCC_PREPROCESSOR_DEFINITIONS = ( 390 | "DEBUG=1", 391 | "$(inherited)", 392 | ); 393 | INFOPLIST_FILE = LBScrollLabelDemoTests/Info.plist; 394 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 395 | PRODUCT_NAME = "$(TARGET_NAME)"; 396 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LBScrollLabelDemo.app/LBScrollLabelDemo"; 397 | }; 398 | name = Debug; 399 | }; 400 | 1A7CE1281BB9159F00E286D0 /* Release */ = { 401 | isa = XCBuildConfiguration; 402 | buildSettings = { 403 | BUNDLE_LOADER = "$(TEST_HOST)"; 404 | FRAMEWORK_SEARCH_PATHS = ( 405 | "$(SDKROOT)/Developer/Library/Frameworks", 406 | "$(inherited)", 407 | ); 408 | INFOPLIST_FILE = LBScrollLabelDemoTests/Info.plist; 409 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 410 | PRODUCT_NAME = "$(TARGET_NAME)"; 411 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LBScrollLabelDemo.app/LBScrollLabelDemo"; 412 | }; 413 | name = Release; 414 | }; 415 | /* End XCBuildConfiguration section */ 416 | 417 | /* Begin XCConfigurationList section */ 418 | 1A7CE0FB1BB9159F00E286D0 /* Build configuration list for PBXProject "LBScrollLabelDemo" */ = { 419 | isa = XCConfigurationList; 420 | buildConfigurations = ( 421 | 1A7CE1211BB9159F00E286D0 /* Debug */, 422 | 1A7CE1221BB9159F00E286D0 /* Release */, 423 | ); 424 | defaultConfigurationIsVisible = 0; 425 | defaultConfigurationName = Release; 426 | }; 427 | 1A7CE1231BB9159F00E286D0 /* Build configuration list for PBXNativeTarget "LBScrollLabelDemo" */ = { 428 | isa = XCConfigurationList; 429 | buildConfigurations = ( 430 | 1A7CE1241BB9159F00E286D0 /* Debug */, 431 | 1A7CE1251BB9159F00E286D0 /* Release */, 432 | ); 433 | defaultConfigurationIsVisible = 0; 434 | }; 435 | 1A7CE1261BB9159F00E286D0 /* Build configuration list for PBXNativeTarget "LBScrollLabelDemoTests" */ = { 436 | isa = XCConfigurationList; 437 | buildConfigurations = ( 438 | 1A7CE1271BB9159F00E286D0 /* Debug */, 439 | 1A7CE1281BB9159F00E286D0 /* Release */, 440 | ); 441 | defaultConfigurationIsVisible = 0; 442 | }; 443 | /* End XCConfigurationList section */ 444 | }; 445 | rootObject = 1A7CE0F81BB9159F00E286D0 /* Project object */; 446 | } 447 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo.xcodeproj/project.xcworkspace/xcshareddata/LBScrollLabelDemo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | F216A7C9-F87C-4D6A-AAE3-E61C2E62CC28 9 | IDESourceControlProjectName 10 | LBScrollLabelDemo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 58D3B2B78CA1639EC7C8A6C1EAC78C0B2E4164A8 14 | https://github.com/lovels/LBScrollLabel.git 15 | 16 | IDESourceControlProjectPath 17 | LBScrollLabelDemo/LBScrollLabelDemo.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 58D3B2B78CA1639EC7C8A6C1EAC78C0B2E4164A8 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/lovels/LBScrollLabel.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 58D3B2B78CA1639EC7C8A6C1EAC78C0B2E4164A8 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 58D3B2B78CA1639EC7C8A6C1EAC78C0B2E4164A8 36 | IDESourceControlWCCName 37 | LBScrollLabel 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo.xcodeproj/xcuserdata/luohuichao.xcuserdatad/xcschemes/LBScrollLabelDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo.xcodeproj/xcuserdata/luohuichao.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LBScrollLabelDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 1A7CE0FF1BB9159F00E286D0 16 | 17 | primary 18 | 19 | 20 | 1A7CE1181BB9159F00E286D0 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LBScrollLabelDemo 4 | // 5 | // Created by luobbe on 15/9/26. 6 | // Copyright (c) 2015年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LBScrollLabelDemo 4 | // 5 | // Created by luobbe on 15/9/26. 6 | // Copyright (c) 2015年 luobbe. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // 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. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 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 | // 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 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo/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" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | luobbe.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo/LBScorllLabel/LBScrollLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // LBScrollLabel.h 3 | // LBScrollLabelDemo 4 | // 5 | // Created by luobbe on 15/9/26. 6 | // Copyright (c) 2015年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger,LBScrollLabelDirection) { 12 | LBScrollLabelDirection_Top, //from bottom to top 13 | LBScrollLabelDirection_Bottom, 14 | LBScrollLabelDirection_Left, 15 | LBScrollLabelDirection_Right, 16 | }; 17 | 18 | //default speed 10 19 | #define LBScrollSpeed 10 20 | 21 | @interface LBScrollLabel : UIView 22 | 23 | @property (nonatomic, strong) UIColor *textColor; 24 | @property (nonatomic, copy) NSString *text; 25 | @property (nonatomic) NSTextAlignment textAlignment; 26 | @property (nonatomic) UIFont *font; 27 | 28 | - (void)beginScrollWithDirection:(LBScrollLabelDirection)direction; /** move labels*/ 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo/LBScorllLabel/LBScrollLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // LBScrollLabel.m 3 | // LBScrollLabelDemo 4 | // 5 | // Created by luobbe on 15/9/26. 6 | // Copyright (c) 2015年 luobbe. All rights reserved. 7 | // 8 | 9 | #import "LBScrollLabel.h" 10 | 11 | @interface LBScrollLabel() 12 | { 13 | CGFloat width; //LBScrollLabel width 14 | CGFloat height; 15 | CGFloat distance; //move distance per second 16 | NSTimer *timer; 17 | } 18 | 19 | @property (nonatomic, strong) UILabel *aLabel; 20 | @property (nonatomic, strong) UILabel *bLabel; 21 | @property (nonatomic, assign) LBScrollLabelDirection direction; 22 | 23 | @end 24 | 25 | @implementation LBScrollLabel 26 | 27 | - (instancetype)initWithFrame:(CGRect)frame { 28 | if (self = [super initWithFrame:frame]) { 29 | // init labels 30 | self.layer.masksToBounds = YES; 31 | width = CGRectGetWidth(self.frame); 32 | height= CGRectGetHeight(self.frame); 33 | [self addSubview:self.aLabel]; 34 | [self addSubview:self.bLabel]; 35 | _aLabel.frame = CGRectMake(0, 0, width, height); 36 | _bLabel.frame = CGRectMake(width, 0, width, height); 37 | } 38 | return self; 39 | } 40 | 41 | - (void)beginScrollWithDirection:(LBScrollLabelDirection)direction { 42 | self.direction = direction; 43 | //move distance per second 44 | distance = LBScrollSpeed * 0.01; 45 | //handel long text 46 | [self handelLabeltextLength]; 47 | //set _bLabel's position 48 | if (_direction == LBScrollLabelDirection_Top) { 49 | _bLabel.frame = CGRectMake(0, height, CGRectGetWidth(_bLabel.frame), height); 50 | }else if (_direction == LBScrollLabelDirection_Bottom) { 51 | _bLabel.frame = CGRectMake(0, -height, CGRectGetWidth(_bLabel.frame), height); 52 | }else if (_direction == LBScrollLabelDirection_Left) { 53 | _bLabel.frame = CGRectMake(CGRectGetMaxX(_aLabel.frame), 0, CGRectGetWidth(_bLabel.frame), height); 54 | }else if (_direction == LBScrollLabelDirection_Right) { 55 | _bLabel.frame = CGRectMake(-CGRectGetMaxX(_aLabel.frame), 0, CGRectGetWidth(_bLabel.frame), height); 56 | } 57 | if (timer != nil) { 58 | [timer invalidate]; 59 | timer = nil; 60 | } 61 | timer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(animationLabel) userInfo:nil repeats:YES]; 62 | } 63 | 64 | - (void)animationLabel { 65 | 66 | switch (_direction) { 67 | case LBScrollLabelDirection_Top: 68 | { 69 | if (fabs(CGRectGetMinY(_aLabel.frame))>=height) { 70 | _aLabel.frame = CGRectMake(0, 0, CGRectGetWidth(_aLabel.frame), height); 71 | _bLabel.frame = CGRectMake(0, height, CGRectGetWidth(_bLabel.frame), height); 72 | } 73 | _aLabel.frame = CGRectMake(0, CGRectGetMinY(_aLabel.frame) - distance, CGRectGetWidth(_aLabel.frame), height); 74 | _bLabel.frame = CGRectMake(0, CGRectGetMinY(_bLabel.frame) - distance, CGRectGetWidth(_bLabel.frame), height); 75 | } 76 | break; 77 | case LBScrollLabelDirection_Bottom: 78 | { 79 | if (fabs(CGRectGetMinY(_aLabel.frame))>=height) { 80 | _aLabel.frame = CGRectMake(0, 0, CGRectGetWidth(_aLabel.frame), height); 81 | _bLabel.frame = CGRectMake(0, -height, CGRectGetWidth(_bLabel.frame), height); 82 | } 83 | _aLabel.frame = CGRectMake(0, CGRectGetMinY(_aLabel.frame) + distance, CGRectGetWidth(_aLabel.frame), height); 84 | _bLabel.frame = CGRectMake(0, CGRectGetMinY(_bLabel.frame) + distance, CGRectGetWidth(_bLabel.frame), height); 85 | } 86 | break; 87 | case LBScrollLabelDirection_Left: 88 | { 89 | if (fabs(CGRectGetMinX(_aLabel.frame))>=CGRectGetWidth(_aLabel.frame)) { 90 | _aLabel.frame = CGRectMake(0, 0, CGRectGetWidth(_aLabel.frame), height); 91 | _bLabel.frame = CGRectMake(CGRectGetMaxX(_aLabel.frame), 0, CGRectGetWidth(_bLabel.frame), height); 92 | } 93 | _aLabel.frame = CGRectMake(CGRectGetMinX(_aLabel.frame) - distance, 0, CGRectGetWidth(_aLabel.frame), height); 94 | _bLabel.frame = CGRectMake(CGRectGetMinX(_bLabel.frame) - distance, 0, CGRectGetWidth(_bLabel.frame), height); 95 | } 96 | break; 97 | case LBScrollLabelDirection_Right: 98 | { 99 | if (fabs(CGRectGetMinX(_aLabel.frame))>=CGRectGetWidth(_aLabel.frame)) { 100 | _aLabel.frame = CGRectMake(0, 0, CGRectGetWidth(_aLabel.frame), height); 101 | _bLabel.frame = CGRectMake(-CGRectGetMaxX(_aLabel.frame), 0, CGRectGetWidth(_bLabel.frame), height); 102 | } 103 | _aLabel.frame = CGRectMake(CGRectGetMinX(_aLabel.frame) + distance, 0, CGRectGetWidth(_aLabel.frame), height); 104 | _bLabel.frame = CGRectMake(CGRectGetMinX(_bLabel.frame) + distance, 0, CGRectGetWidth(_bLabel.frame), height); 105 | } 106 | break; 107 | } 108 | } 109 | 110 | //textColor 111 | - (void)setTextColor:(UIColor *)textColor { 112 | _aLabel.textColor = textColor; 113 | _bLabel.textColor = textColor; 114 | } 115 | 116 | //text 117 | - (void)setText:(NSString *)text { 118 | _aLabel.text = text; 119 | _bLabel.text = text; 120 | //handel long text 121 | [self handelLabeltextLength]; 122 | } 123 | 124 | //textAlignment 125 | - (void)setTextAlignment:(NSTextAlignment)textAlignment { 126 | _aLabel.textAlignment = textAlignment; 127 | _bLabel.textAlignment = textAlignment; 128 | } 129 | 130 | //font 131 | - (void)setFont:(UIFont *)font { 132 | _aLabel.font = font; 133 | _bLabel.font = font; 134 | } 135 | 136 | // handel text too long 137 | - (void)handelLabeltextLength 138 | { 139 | if (self.direction == LBScrollLabelDirection_Top || self.direction == LBScrollLabelDirection_Bottom) { 140 | _aLabel.frame = CGRectMake(_aLabel.frame.origin.x, _aLabel.frame.origin.y, width, height); 141 | _bLabel.frame = CGRectMake(_bLabel.frame.origin.x, _bLabel.frame.origin.y, width, height); 142 | }else if (self.direction == LBScrollLabelDirection_Left || self.direction == LBScrollLabelDirection_Right) { 143 | [_aLabel sizeToFit]; 144 | [_bLabel sizeToFit]; 145 | if (CGRectGetWidth(_aLabel.frame) <= width) { 146 | // 147 | _aLabel.frame = CGRectMake(_aLabel.frame.origin.x, _aLabel.frame.origin.y, width, height); 148 | _bLabel.frame = CGRectMake(_bLabel.frame.origin.x, _bLabel.frame.origin.y, width, height); 149 | }else{ 150 | _aLabel.frame = CGRectMake(_aLabel.frame.origin.x, _aLabel.frame.origin.y, CGRectGetWidth(_aLabel.frame), height); 151 | _bLabel.frame = CGRectMake(CGRectGetMaxX(_aLabel.frame), _bLabel.frame.origin.y, CGRectGetWidth(_aLabel.frame), height); 152 | } 153 | } 154 | } 155 | 156 | - (UILabel *)aLabel { 157 | if (_aLabel == nil) { 158 | _aLabel = [UILabel new]; 159 | _aLabel.backgroundColor = [UIColor clearColor]; 160 | } 161 | return _aLabel; 162 | } 163 | 164 | - (UILabel *)bLabel { 165 | if (_bLabel == nil) { 166 | _bLabel = [UILabel new]; 167 | _bLabel.backgroundColor = [UIColor clearColor]; 168 | } 169 | return _bLabel; 170 | } 171 | 172 | @end 173 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LBScrollLabelDemo 4 | // 5 | // Created by luobbe on 15/9/26. 6 | // Copyright (c) 2015年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LBScrollLabelDemo 4 | // 5 | // Created by luobbe on 15/9/26. 6 | // Copyright (c) 2015年 luobbe. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "LBScrollLabel.h" 11 | 12 | @interface ViewController () 13 | 14 | 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view, typically from a nib. 22 | self.title = @"LBScrollLabel"; 23 | NSArray *scrollLBArray = @[[NSNumber numberWithInteger:LBScrollLabelDirection_Top], 24 | [NSNumber numberWithInteger:LBScrollLabelDirection_Bottom], 25 | [NSNumber numberWithInteger:LBScrollLabelDirection_Left], 26 | [NSNumber numberWithInteger:LBScrollLabelDirection_Right] 27 | ]; 28 | NSArray *scrollLBText = @[@"Scroll label, from bottom to top!", 29 | @"Scroll label, from top to bottom!", 30 | @"Hello, I am a scroll label, from right to left! I can become long longer longest ", 31 | @"Hello, I am a scroll label, from left to right! I can become long longer longest ", 32 | ]; 33 | 34 | [scrollLBArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { 35 | // 36 | NSNumber *direction = (NSNumber *)obj; 37 | LBScrollLabel *tempLB = [[LBScrollLabel alloc] initWithFrame:CGRectMake(20, 100 + 50 *idx, CGRectGetWidth(self.view.frame) - 40, 30)]; 38 | tempLB.backgroundColor = [UIColor colorWithRed:(arc4random()%255)/255.0 green:(arc4random()%255)/255.0 blue:(arc4random()%255)/255.0 alpha:1]; 39 | tempLB.text = [scrollLBText objectAtIndex:direction.integerValue]; 40 | [tempLB beginScrollWithDirection:direction.integerValue]; 41 | [self.view addSubview:tempLB]; 42 | }]; 43 | } 44 | 45 | - (void)didReceiveMemoryWarning { 46 | [super didReceiveMemoryWarning]; 47 | // Dispose of any resources that can be recreated. 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LBScrollLabelDemo 4 | // 5 | // Created by luobbe on 15/9/26. 6 | // Copyright (c) 2015年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | luobbe.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LBScrollLabelDemo/LBScrollLabelDemoTests/LBScrollLabelDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LBScrollLabelDemoTests.m 3 | // LBScrollLabelDemoTests 4 | // 5 | // Created by luobbe on 15/9/26. 6 | // Copyright (c) 2015年 luobbe. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface LBScrollLabelDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation LBScrollLabelDemoTests 17 | 18 | - (void)setUp { 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 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LBScrollLabel 2 | 3 | 4 | **效果** 5 | 6 | ![](http://www.luobbe.com/content/images/2015/09/scrollLabel.gif) 7 | 8 | **使用** 9 | 10 | ``` 11 | LBScrollLabel *tempLB = [[LBScrollLabel alloc] initWithFrame:CGRectMake(20, 100, CGRectGetWidth(self.view.frame) - 40, 30)]; 12 | tempLB.backgroundColor = [UIColor colorWithRed:(arc4random()%255)/255.0 green:(arc4random()%255)/255.0 blue:(arc4random()%255)/255.0 alpha:1]; 13 | tempLB.text = @"Scroll label, from bottom to top!"; 14 | [tempLB beginScrollWithDirection:LBScrollLabelDirection_Top]; 15 | [self.view addSubview:tempLB]; 16 | 17 | ``` --------------------------------------------------------------------------------