Closed Benyi-Peng closed 7 years ago
Hi,@Benyi-Peng,每次调用 scrollTitle 的 setter 方法时,都会在 -updateScrollingType_xxxx 方法中重置 self.contentOffset,因此不存在此问题。
你好!
不好意思我没把我的使用场景说清楚~
只有当文本长度超过TXScrollLabelView
的宽度,才会开启滚动的scrollTimer
.
我在项目中使用TXScrollLabelView
来显示歌名。当切换歌曲的时候,歌的名字没那么长了 ,我就会调用endScrolling
。既然scrollTimer
作废了,当然就不会去-updateScrollingType_xxxx
重置self.contentOffset
啦。
所以我选择在setScrollTitle:
->resetScrollLabelView
->setupSubviewsLayout
->setupSubviewsLayout_LeftRight
中重置contentOffset
(因为我在项目中使用的是TXScrollLabelViewTypeLeftRight
方向)。
这个修改也仅仅只考虑到了这种使用场景下的需求,需不需要覆盖这个场景就看你的啦。
👍,也可以把上下滚动的情况考虑一下
如果把控件的长文本切换成短文本,而没有把控件的
contentOffset
置0,会有bug哦