文本广告轮播&&横向滚动

【链接】https://github.com/MrJalen/LabelRollingView

示例图

labelRolling.gif

单行文本广告轮播

LabelRollingView

AnnouncementView *announcementView = [[AnnouncementView alloc] initWithFrame:CGRectMake(15, (kIsiPhoneX?88:64), kScreenWidth-30, 30)];
announcementView.textArray = [NSMutableArray arrayWithArray:@[@"1.紧急公告...", @"2.到货通知...", @"3.您有新订单生成..."]];
announcementView.hidden = NO;
[self.view addSubview:announcementView];
[announcementView setSelectRollingIndex:^(NSInteger index) {
    NSLog(@"---选中了第 %ld 条公告---", (long)index+1);
        
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@""
                        message:[NSString stringWithFormat:@"选中了第 %ld 条公告", (long)index+1]
                        delegate:nil
                        cancelButtonTitle:@"确定"
                        otherButtonTitles:nil, nil];
    [alert show];
}];

单行文本横向滚动

LabelAcrossRollingView

LabelAcrossRollingView *acrossRollingView = [[LabelAcrossRollingView alloc] initWithFrame:CGRectMake(15, announcementView.frame.origin.y+announcementView.frame.size.height+20, kScreenWidth-30, 30) title:@"生活不曾取悦于我,所以我创造了自己的生活!"];
[self.view addSubview:acrossRollingView];

版权声明:本文为博主原创文章,未经博主允许不得转载。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容