实现轮播播报这个功能主要用到了GCD定时器以及两个视图,循环播报的思想。下面介绍主要实现的代码逻辑:
1.首先定义用到的视图,为了让播报不出现空间断,所以定义了两个播报视图:
@interface ReportInvestInfoView()
@property(nonatomic, strong) UIImageView *hornImgView;//播报喇叭的icon,显示用的,可以不用理会
@property(nonatomic, strong) UIView *bkgView; //第一个播报视图
@property(nonatomic, strong) UILabel *frontLabel;
@property(nonatomic, strong) UILabel *lastLabel;
@property(nonatomic, strong) UIView *nextBkgView;// 第二个播报视图
@property(nonatomic, strong) UILabel *nextFrontLabel;
@property(nonatomic, strong) UILabel *nextLastLabel;
@property(nonatomic, strong) dispatch_source_t timer;
@property(nonatomi