Giter Club home page Giter Club logo

txscrolllabelview's Introduction

TXScrollLabelView is an iOS lightweight library that can displays adverts or boardcast e.g. with an custom view.

中文介绍

x-scroll-label-view

Support what kinds of scrollType

  • TXScrollLabelViewTypeLeftRight : scrolling from right to left, and cycle all contents(scrollTitle) in a single line.

  • TXScrollLabelViewTypeUpDown: scrolling from bottom to top, and cycle all contents.

  • TXScrollLabelViewTypeFlipRepeat: scrolling from bottom to top, and cycle the first line of your contents.

  • TXScrollLabelViewTypeFlipNoRepeat: scrolling from bottom to top, and cycle all contents with a line once times.

And scrollVelocity property now supports all above enum of TXScrollLabelViewType, just enjoy it!

Installation

There are three ways to use TXScrollLabelView in your project:

  • Using CocoaPods

  • Manual

  • Using Carthage

CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects.

Podfile

platform :ios, '7.0'
pod 'TXScrollLabelView'

Manual

Download repo's zip, and just drag ALL files in the TXScrollLabelView folder to your projects. Import header file when you are using:

#import "TXScrollLabelView.h"

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate TXScrollLableView into your Xcode project using Carthage, specify it in your Cartfile:

github "tingxins/TXScrollLableView"

Run carthage to build the frameworks and drag the framework into your Xcode project.

Usage

Now, TXScrollLabelView supports both array & string. just enjoy it. 👀

Example

Objective-C :

/** Step1: 滚动文字 */
NSString *scrollTitle = @"xxxxxx";

/** Step2: 创建 ScrollLabelView */
TXScrollLabelView *scrollLabelView = [TXScrollLabelView scrollWithTitle:scrollTitle type:TXScrollLabelViewTypeFlipNoRepeat velocity:velocity options:UIViewAnimationOptionCurveEaseInOut];

/** Step3: 设置代理进行回调(Optional) */
scrollLabelView.scrollLabelViewDelegate = self;

/** Step4: 布局(Required) */
scrollLabelView.frame = CGRectMake(50, 100, 300, 30);
[self.view addSubview:scrollLabelView];

/** Step5: 开始滚动(Start scrolling!) */
[scrollLabelView beginScrolling];

You can running TXScrollLabelViewDemo for more details.

Swift : Producting.(Swift-version)

Delegate Method

Tap Gesture callback.


- (void)scrollLabelView:(TXScrollLabelView *)scrollLabelView didClickWithText:(NSString *)text atIndex:(NSInteger)index;

Communication

Absolutely,you can contribute to this project all the time if you want to.

  • If you need help or ask general question, just @tingxins in Weibo or Twitter, ofcourse, you can access to my blog.

  • If you found a bug, just open an issue.

  • If you have a feature request, just open an issue.

  • If you want to contribute, fork this repository, and then submit a pull request.

License

TXScrollLabelView is available under the MIT license. See the LICENSE file for more info.

Ad

Welcome to my Official Account of WeChat.

wechat-qrcode

txscrolllabelview's People

Contributors

chenyingping avatar tingxins avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

txscrolllabelview's Issues

滚动过程中重新设置内容,会导致动画异常

flipAnimationWithDelay 方法里面设动画完成回调之后,交换uplabel、downlabel,如果动画开始和动画结束之间重新设置内容,uplabel、downlabel 会重新布局,重新开始执行动画,在动画执行过程中如果执行上一次的完成回调,则动画会执行异常

建议新功能

1.可以支持数组title 滚动
2.每个滚动完毕之后返回一个代理方法

关于添加富文本

你好 数组方法怎么添加富文本啊?我找了很久没找到,如果有方法添加可否在demo中演示一下,谢谢

它支持 xib 创建吗?

我在 cell 中替换掉了一个 label ,我设置了它的一些属性,包括滚动样式和滚动速度
然后在 setModel 中设置了它的文字和让它开始滚动,可是,真正运行起来以后界面上空白的 ..
我看了视图结构,它是存在的,但是上面没有文字 .. so 不能通过 xib 直接使用该 View 吗

初始化完成后,当我访问网络后怎么刷新数组

我把数组属性改到.h文件了;我做了模拟,但是更新无效:
`
NSArray *scrollTexts = @[@"今日到馆:100人",
@"图书借出:100册"];

_scrollLabelView = [TXScrollLabelView scrollWithTextArray:scrollTexts type:TXScrollLabelViewTypeFlipNoRepeat velocity:3 options:UIViewAnimationOptionCurveEaseInOut inset:UIEdgeInsetsMake(0, 0, 0, 10)];
[_scrollLabelView setBackgroundColor:UIColorFromHexRGB(0xffffff)];
[_scrollLabelView setScrollTitleColor:UIColorFromHexRGB(0x000000)];
_scrollLabelView.font = [UIFont systemFontOfSize:15];
_scrollLabelView.textAlignment = NSTextAlignmentRight;
_scrollLabelView.scrollLabelViewDelegate = self;
[marqueeView addSubview:_scrollLabelView];
_scrollLabelView.frame = CGRectMake(110, 0, SCREEN_WIDTH-120, 44);
[_scrollLabelView beginScrolling];

scrollTexts = @[@"今日到馆:300人",
                @"图书借出:200册"];

_scrollLabelView.scrollArray = scrollTexts;
[_scrollLabelView beginScrolling];

`

Code4App 是一个移动平台的代码库。

hi 觉得您的文章写得不错,您可以授权文章发表在 http://www.code4app.com 上面么?期待您的回复!

Code4App 是一个移动平台的代码库。
Code4App 收集了 iOS 平台近 5 千份代码。
我们不需要造轮子,我们应该将我们的聪明才智发挥到其他更 牛逼 的创意上去。

滚动有点卡顿

滚动有点卡顿,是否可以考虑缩短定时器更新UI的时间间隔来消除这种不流畅的感觉呢?

添加一个动画的翻滚时间

你现在动画翻滚时间为 scrollVelocity * 0.5
实际中动画翻滚时间1s,展示时间为3s。
现在没有开放接口,我只能修改pod 文件实现

内存泄漏

CTFontCreateWithName
CTFramesetterCreateWithAttributedString
CTFramesetterCreateFrame
以上三个位置内存泄漏,需要调用CFRelease

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.