tingxins / TXScrollLabelView

🌭TXScrollLabelView, the best way to show & display information such as adverts / boardcast / onsale e.g. with a customView.
https://tingxins.com/2016/11/scrolling-txscrolllabelview/
MIT License
730 stars 127 forks source link

修复Benyi-Peng提出的issue #17

Closed Benyi-Peng closed 7 years ago

Benyi-Peng commented 7 years ago

如果把控件的长文本切换成短文本,而没有把控件的contentOffset置0,会有bug哦

tingxins commented 7 years ago

Hi,@Benyi-Peng,每次调用 scrollTitle 的 setter 方法时,都会在 -updateScrollingType_xxxx 方法中重置 self.contentOffset,因此不存在此问题。

Benyi-Peng commented 7 years ago

你好! 不好意思我没把我的使用场景说清楚~ 只有当文本长度超过TXScrollLabelView的宽度,才会开启滚动的scrollTimer.

我在项目中使用TXScrollLabelView来显示歌名。当切换歌曲的时候,歌的名字没那么长了 ,我就会调用endScrolling。既然scrollTimer作废了,当然就不会去-updateScrollingType_xxxx重置self.contentOffset啦。 所以我选择在setScrollTitle:->resetScrollLabelView->setupSubviewsLayout->setupSubviewsLayout_LeftRight中重置contentOffset(因为我在项目中使用的是TXScrollLabelViewTypeLeftRight方向)。 这个修改也仅仅只考虑到了这种使用场景下的需求,需不需要覆盖这个场景就看你的啦。

tingxins commented 7 years ago

👍,也可以把上下滚动的情况考虑一下