diff --git a/LMJScrollText.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/LMJScrollText.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000..18d9810
--- /dev/null
+++ b/LMJScrollText.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/LMJScrollText.xcodeproj/project.xcworkspace/xcuserdata/dd.xcuserdatad/UserInterfaceState.xcuserstate b/LMJScrollText.xcodeproj/project.xcworkspace/xcuserdata/dd.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644
index 0000000..e6705b1
Binary files /dev/null and b/LMJScrollText.xcodeproj/project.xcworkspace/xcuserdata/dd.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/LMJScrollText.xcodeproj/xcuserdata/dd.xcuserdatad/xcschemes/xcschememanagement.plist b/LMJScrollText.xcodeproj/xcuserdata/dd.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..3db60bc
--- /dev/null
+++ b/LMJScrollText.xcodeproj/xcuserdata/dd.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,14 @@
+
+
+
+
+ SchemeUserState
+
+ LMJScrollText.xcscheme
+
+ orderHint
+ 0
+
+
+
+
diff --git a/LMJScrollText/ViewController.m b/LMJScrollText/ViewController.m
index 99df256..02f3016 100644
--- a/LMJScrollText/ViewController.m
+++ b/LMJScrollText/ViewController.m
@@ -16,7 +16,9 @@ @interface ViewController ()
LMJScrollTextView * _scrollTextView1_2;
LMJScrollTextView * _scrollTextView2;
+ LMJScrollTextView * _scrollTextView21;
LMJScrollTextView * _scrollTextView3;
+ LMJScrollTextView * _scrollTextView31;
LMJScrollTextView * _scrollTextView4;
LMJScrollTextView * _scrollTextView5;
LMJScrollTextView * _scrollTextView6;
@@ -68,6 +70,7 @@ - (void)viewDidLoad {
[_scrollTextView2 startScrollWithText:@"<<<向左连续滚动字符串|向左连续滚动字符串|向左连续滚动字符串" textColor:[UIColor blackColor] font:[UIFont systemFontOfSize:16]];
+
//向右,连续滚动
[self addLabelWithFrame:CGRectMake(10, 185, 400, 20) text:@"向右,连续滚动(right,continuous)"];
@@ -129,7 +132,24 @@ - (void)viewDidLoad {
+ //向左,连续滚动,超过一半,就开始新的
+ [self addLabelWithFrame:CGRectMake(10, 475, 400, 20) text:@"向左,连续滚动(left,continuousHalf)"];
+
+ _scrollTextView21 = [[LMJScrollTextView alloc] initWithFrame:CGRectMake(10, 495, 300, 30) textScrollModel:LMJTextScrollContinuousHalf direction:LMJTextScrollMoveLeft];
+ _scrollTextView21.backgroundColor = [UIColor whiteColor];
+ [self.view addSubview:_scrollTextView21];
+
+ [_scrollTextView21 startScrollWithText:@"<<<向左连续滚动字符串|向左连续滚动字符串|向左连续滚动字符串" textColor:[UIColor blackColor] font:[UIFont systemFontOfSize:16]];
+
+
+ //向右,连续滚动 滚到一半重新出现
+ [self addLabelWithFrame:CGRectMake(10, 525, 400, 20) text:@"向右,连续滚动(right,continuousHalf)"];
+
+ _scrollTextView31 = [[LMJScrollTextView alloc] initWithFrame:CGRectMake(10, 545, 300, 30) textScrollModel:LMJTextScrollContinuousHalf direction:LMJTextScrollMoveRight];
+ _scrollTextView31.backgroundColor = [UIColor whiteColor];
+ [self.view addSubview:_scrollTextView31];
+ [_scrollTextView31 startScrollWithText:@"向右连续滚动字符串>>>" textColor:[UIColor blackColor] font:[UIFont systemFontOfSize:16]];
@@ -162,6 +182,8 @@ -(void)changeSpeed{
[_scrollTextView5 setMoveSpeed:speed];
[_scrollTextView6 setMoveSpeed:speed];
[_scrollTextView7 setMoveSpeed:speed];
+ [_scrollTextView21 setMoveSpeed:speed];
+ [_scrollTextView31 setMoveSpeed:speed];
}
}
diff --git a/LMJScrollTextView/LMJScrollTextView.h b/LMJScrollTextView/LMJScrollTextView.h
index b353c53..6a1da08 100644
--- a/LMJScrollTextView/LMJScrollTextView.h
+++ b/LMJScrollTextView/LMJScrollTextView.h
@@ -19,6 +19,7 @@
*/
typedef enum {
LMJTextScrollContinuous, // 从控件内开始连续滚动
+ LMJTextScrollContinuousHalf, // 自定义 连续滚动过半、就开始下一个
LMJTextScrollIntermittent, // 从控件内开始间断滚动
LMJTextScrollFromOutside, // 从控件外开始滚动
LMJTextScrollWandering // 在控件中往返滚动(不受设置方向影响)
diff --git a/LMJScrollTextView/LMJScrollTextView.m b/LMJScrollTextView/LMJScrollTextView.m
index f8a21d3..2fde838 100644
--- a/LMJScrollTextView/LMJScrollTextView.m
+++ b/LMJScrollTextView/LMJScrollTextView.m
@@ -103,6 +103,16 @@ -(void)startScroll{
}break;
+ case LMJTextScrollContinuousHalf:
+ {
+ if (_currentMoveDirection == LMJTextScrollMoveLeft) {
+ [self creatLabel1WithFrame1:CGRectMake(0, 0, _textWidth, self.frame.size.height) andLabel2WithFrame2:CGRectMake(self.frame.size.width/2 + _textWidth, 0, _textWidth, self.frame.size.height)];
+ }else{
+ [self creatLabel1WithFrame1:CGRectMake(self.frame.size.width -_textWidth, 0, _textWidth, self.frame.size.height) andLabel2WithFrame2:CGRectMake(self.frame.size.width -_textWidth -_textWidth - self.frame.size.width/2, 0, _textWidth, self.frame.size.height)];
+ }
+
+ }break;
+
case LMJTextScrollIntermittent:
{
if (_currentMoveDirection == LMJTextScrollMoveLeft) {
@@ -182,6 +192,11 @@ - (void)contentMove {
[self moveContinuous];
}
break;
+ case LMJTextScrollContinuousHalf:
+ {
+ [self moveContinuousHalf];
+ }
+ break;
case LMJTextScrollIntermittent:
{
[self moveIntermittent];
@@ -223,6 +238,29 @@ -(void)moveContinuous{
}
}
}
+
+//连续滚动中间过半就出现
+-(void)moveContinuousHalf{
+ if (_currentMoveDirection == LMJTextScrollMoveLeft) {
+ _contentLabel1.frame = CGRectMake(_contentLabel1.frame.origin.x -1, 0, _textWidth, self.frame.size.height);
+ _contentLabel2.frame = CGRectMake(_contentLabel2.frame.origin.x -1, 0, _textWidth, self.frame.size.height);
+ if (_contentLabel1.frame.origin.x < -_textWidth) {
+ _contentLabel1.frame = CGRectMake(_contentLabel2.frame.origin.x + _textWidth + self.frame.size.width/2, 0, _textWidth, self.frame.size.height);
+ }
+ if (_contentLabel2.frame.origin.x < -_textWidth) {
+ _contentLabel2.frame = CGRectMake(_contentLabel1.frame.origin.x + _textWidth + self.frame.size.width/2, 0, _textWidth, self.frame.size.height);
+ }
+ }else{
+ _contentLabel1.frame = CGRectMake(_contentLabel1.frame.origin.x +1, 0, _textWidth, self.frame.size.height);
+ _contentLabel2.frame = CGRectMake(_contentLabel2.frame.origin.x +1, 0, _textWidth, self.frame.size.height);
+ if (_contentLabel1.frame.origin.x > self.frame.size.width) {
+ _contentLabel1.frame = CGRectMake(_contentLabel2.frame.origin.x - _textWidth - self.frame.size.width/2, 0, _textWidth, self.frame.size.height);
+ }
+ if (_contentLabel2.frame.origin.x > self.frame.size.width) {
+ _contentLabel2.frame = CGRectMake(_contentLabel1.frame.origin.x - _textWidth- self.frame.size.width/2, 0, _textWidth, self.frame.size.height);
+ }
+ }
+}
//间断滚动
-(void)moveIntermittent{
if (_currentMoveDirection == LMJTextScrollMoveLeft) {