TXScrollLabelView-ランニングライトのようなスクロールビューフレーム
3400 ワード
⭐️⭐️⭐️
以下の内容は公式ソースコード、READMEドキュメント、テストDemoまたは個人使用総括に由来します.
使用法
/** Step1: */
NSString *scrollTitle = @"xxxxxx";
/** Step2: ScrollLabelView */
TXScrollLabelView *scrollLabelView = [TXScrollLabelView scrollWithTitle:scrollTitle type:TXScrollLabelViewTypeFlipNoRepeat velocity:velocity options:UIViewAnimationOptionCurveEaseInOut];
/** Step3: (Optional) */
scrollLabelView.scrollLabelViewDelegate = self;
/** Step4: (Required) */
scrollLabelView.frame = CGRectMake(50, 100, 300, 30);
[self.view addSubview:scrollLabelView];
/** Step5: (Start scrolling!) */
[scrollLabelView beginScrolling];
Demo:
// Label
// step1:
NSString *scrollTitle = @" XXX !";
// step2: scrollLabelView
TXScrollLabelView *scrollLabelView = [TXScrollLabelView scrollWithTitle:scrollTitle type:TXScrollLabelViewTypeFlipRepeat velocity:3 options:UIViewAnimationOptionTransitionNone];
scrollLabelView.backgroundColor = [UIColor clearColor];
scrollLabelView.scrollTitleColor = [UIColor blackColor];
// step3: (Optional)
// scrollLabelView.scrollLabelViewDelegate = self;
// step4:
scrollLabelView.frame = CGRectMake(31, 31, 240, 21);
[self.view addSubview:scrollLabelView];
// [scrollLabelView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.equalTo(speakerImage.mas_top);
// make.left.equalTo(speakerImage.mas_right).with.offset(0);
// make.size.mas_equalTo(CGSizeMake(240, 21));
// }];
// step5:
[scrollLabelView beginScrolling];
その他
CGRect rect = CGRectMake(31,31, 240, 21);
SXHeadLine *headline = [[SXHeadLine alloc] initWithFrame:rect];
headline.messageArray = @[@" XXX !!"];
[headline setScrollDuration:0.5 stayDuration:3.0];
[headline changeTapMarqueeAction:^(NSInteger index) {
//
}];
[headline start];
[self.view addSubview:headline];
// >>>>>>>>>>>>>>>>>>>>>>>>> demo 4 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// ---
// , , 100%
SDCycleScrollView *cycleScrollView4 = [SDCycleScrollView
cycleScrollViewWithFrame:CGRectMake(0, 750, w, 40)
delegate:self
placeholderImage:nil];
cycleScrollView4.scrollDirection = UICollectionViewScrollDirectionVertical;
cycleScrollView4.onlyDisplayText = YES;
NSMutableArray *titlesArray = [NSMutableArray new];
[titlesArray addObject:@" "];
[titlesArray addObject:@" -- demo 4"];
[titlesArray addObjectsFromArray:titles];
cycleScrollView4.titlesGroup = [titlesArray copy];
[demoContainerView addSubview:cycleScrollView4];