diff --git a/TXScrollLabelView/TXScrollLabelView.h b/TXScrollLabelView/TXScrollLabelView.h index d23d9af..8c1c1f9 100644 --- a/TXScrollLabelView/TXScrollLabelView.h +++ b/TXScrollLabelView/TXScrollLabelView.h @@ -113,6 +113,12 @@ typedef NS_ENUM(NSInteger, TXScrollLabelViewType) { inset:(UIEdgeInsets)inset; #pragma mark - Operation Methods + +/** + 当需要重置位置的赋值的时候 + */ +- (void)resetPosition; + /** * 开始滚动 */ diff --git a/TXScrollLabelView/TXScrollLabelView.m b/TXScrollLabelView/TXScrollLabelView.m index a278d18..1fc29d1 100644 --- a/TXScrollLabelView/TXScrollLabelView.m +++ b/TXScrollLabelView/TXScrollLabelView.m @@ -544,6 +544,31 @@ - (void)updateUpDownScrollLabelLayoutWithText:(NSString *)text labelType:(TXScro #pragma mark - Scrolling Operation Methods -- Public +- (void)resetPosition +{ + self.contentOffset = CGPointMake(0, 0); + switch (_scrollType) { + case TXScrollLabelViewTypeLeftRight: + [self setupSubviewsLayout_LeftRight]; + break; + case TXScrollLabelViewTypeUpDown: + [self setupSubviewsLayout_UpDown]; + break; + case TXScrollLabelViewTypeFlipRepeat: { + [self setupSubviewsLayout_Flip]; + [self setupTitle:_scrollTitle]; + } + break; + case TXScrollLabelViewTypeFlipNoRepeat: + [self setupSubviewsLayout_Flip]; + break; + + default: + break; + } +} + + - (void)beginScrolling { self.currentSentence = 0; if (self.isArray) { diff --git a/TXScrollLabelViewDemo/TXScrollLabelViewDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/TXScrollLabelViewDemo/TXScrollLabelViewDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/TXScrollLabelViewDemo/TXScrollLabelViewDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + +