Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
add 自适应计算singleScrollDuration
  • Loading branch information
jinht committed Oct 9, 2018
1 parent 3baa3eb commit 3905a29
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
11 changes: 6 additions & 5 deletions JhtMarquee.framework/Headers/JhtHorizontalMarquee.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,22 @@
@interface JhtHorizontalMarquee : UILabel

#pragma mark - property
/** 获取_是否处于_暂停状态 */
/** 当前_是否为_暂停状态 */
@property (nonatomic, assign, readonly) BOOL isPaused;



#pragma mark - Public Method
/** 初始化
* duration:单次滚动时间
* duration: 单次滚动时间
* 注: duration = 0.0,使用内部自适应计算功能
*/
- (instancetype)initWithFrame:(CGRect)frame withSingleScrollDuration:(NSTimeInterval)duration;
- (instancetype)initWithFrame:(CGRect)frame singleScrollDuration:(NSTimeInterval)duration;

#pragma mark 设置跑马灯状态
/** 设置跑马灯状态
* marqueeState跑马灯状态(MarqueeState_H)
* 注《开启跑马灯》放在viewDidAppear中,《关闭跑马灯》放在viewWillDisappear中
* marqueeState: 跑马灯状态(MarqueeState_H)
* 注: 《开启跑马灯》放在viewDidAppear中,《关闭跑马灯》放在viewWillDisappear中
*/
- (void)marqueeOfSettingWithState:(MarqueeState_H)marqueeState;

Expand Down
20 changes: 10 additions & 10 deletions JhtMarquee.framework/Headers/JhtVerticalMarquee.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,43 @@
@property (nonatomic, assign, readonly) NSInteger currentIndex;

/** 是否为逆时针滚动
* defaultNO
* 顺时针底部 ===> 顶部
* 逆时针顶部 ===> 底部
* default: NO
* 顺时针: 底部 ===> 顶部
* 逆时针: 顶部 ===> 底部
*/
@property (nonatomic, assign) BOOL isCounterclockwise;

/** 单次滚动 时间
* default0.5f
* default: 0.5f
*/
@property (nonatomic, assign) CGFloat scrollDuration;
/** 滚动延迟 时间
* default3.0f
* default: 3.0f
*/
@property (nonatomic, assign) CGFloat scrollDelay;

/** 文字 颜色
* default[UIColor blackColor]
* default: [UIColor blackColor]
*/
@property (nonatomic, strong) UIColor *verticalTextColor;
/** 文字 字体
* default[UIFont systemFontOfSize:14]
* default: [UIFont systemFontOfSize:14]
*/
@property (nonatomic, strong) UIFont *verticalTextFont;
/** 文字 对齐方式
* defaultNSTextAlignmentLeft
* default: NSTextAlignmentLeft
*/
@property (nonatomic, assign) NSTextAlignment verticalTextAlignment;
/** 文字 行数
* default2(注意一下self.frame的设置)
* default: 2(注意一下self.frame的设置)
*/
@property (nonatomic, assign) NSInteger verticalNumberOfLines;



#pragma mark - Public Method
/** 设置跑马灯状态
* marqueeState:状态(MarqueeState_V)
* marqueeState: 目标状态(MarqueeState_V)
*/
- (void)marqueeOfSettingWithState:(MarqueeState_V)marqueeState;

Expand Down
Binary file modified JhtMarquee.framework/Info.plist
Binary file not shown.
Binary file modified JhtMarquee.framework/JhtMarquee
Binary file not shown.
2 changes: 0 additions & 2 deletions JhtMarquee.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
78808ADD1E6EADB60081C941 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 78808AC91E6EADB60081C941 /* Assets.xcassets */; };
78808ADE1E6EADB60081C941 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 78808ACA1E6EADB60081C941 /* LaunchScreen.storyboard */; };
78808ADF1E6EADB60081C941 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 78808ACC1E6EADB60081C941 /* Main.storyboard */; };
78808AE01E6EADB60081C941 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 78808ACE1E6EADB60081C941 /* Info.plist */; };
78808AE31E6EADB60081C941 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 78808AD61E6EADB60081C941 /* main.m */; };
78808AE41E6EADB60081C941 /* testVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 78808AD91E6EADB60081C941 /* testVC.m */; };
78808AE51E6EADB60081C941 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 78808ADB1E6EADB60081C941 /* ViewController.m */; };
Expand Down Expand Up @@ -266,7 +265,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
78808AE01E6EADB60081C941 /* Info.plist in Resources */,
78808ADF1E6EADB60081C941 /* Main.storyboard in Resources */,
78808ADD1E6EADB60081C941 /* Assets.xcassets in Resources */,
78808ADE1E6EADB60081C941 /* LaunchScreen.storyboard in Resources */,
Expand Down
13 changes: 7 additions & 6 deletions JhtMarquee/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ - (void)viewDidLoad {
self.automaticallyAdjustsScrollViewInsets = NO;

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
self.navigationController.interactivePopGestureRecognizer.delegate = self;

self.navigationController.interactivePopGestureRecognizer.enabled = YES;
self.navigationController.interactivePopGestureRecognizer.delegate = self;
#else
self.navigationController.interactivePopGestureRecognizer.delegate = self;
self.navigationController.interactivePopGestureRecognizer.delegate = self;
#endif

[self createUI];
Expand All @@ -73,6 +73,7 @@ - (void)viewDidLoad {
- (void)createUI {
self.view.backgroundColor = [UIColor whiteColor];

self.navigationController.navigationBar.translucent = NO;
self.title = @"JhtMarqueeDemo";

// 添加 横向 跑马灯
Expand All @@ -86,7 +87,7 @@ - (void)createUI {
#pragma mark 横向 跑马灯
/** 添加 横向 跑马灯 */
- (void)addHorizontalMarquee {
self.horizontalMarquee.text = @" 这是一个跑马灯View,测试一下好不好用,哈哈哈,😁👌😀 😁👌😀 😁👌😀 😁👌😀 哈哈哈哈! ";
self.horizontalMarquee.text = @" 这是一个跑马灯View,测试一下好不好用,哈哈哈,😁👌😀 😁👌😀 😁👌😀 😁👌😀 哈哈哈哈! 这是一个跑马灯View,测试一下好不好用,哈哈哈,😁👌😀 😁👌😀 😁👌😀 😁👌😀 哈哈哈哈! 这是一个跑马灯View,测试一下好不好用,哈哈哈,😁👌😀 😁👌😀 😁👌😀 😁👌😀 哈哈哈哈! 这是一个跑马灯View,测试一下好不好用,哈哈哈,😁👌😀 😁👌😀 😁👌😀 😁👌😀 哈哈哈哈! ";
[self.view addSubview:self.horizontalMarquee];
}

Expand Down Expand Up @@ -132,7 +133,7 @@ - (void)addVerticalMarquee {
/** 横向 跑马灯 */
- (JhtHorizontalMarquee *)horizontalMarquee {
if (!_horizontalMarquee) {
_horizontalMarquee = [[JhtHorizontalMarquee alloc] initWithFrame:CGRectMake(0, 66, FrameW, 40) withSingleScrollDuration:10.0];
_horizontalMarquee = [[JhtHorizontalMarquee alloc] initWithFrame:CGRectMake(0, 66, FrameW, 40) singleScrollDuration:0.0];

_horizontalMarquee.tag = 100;
// 添加点击手势
Expand Down

0 comments on commit 3905a29

Please sign in to comment.