废话不多说,先看图,看实现过程,



解释下核心方法:
// 第一个参数: 1 为每秒调用一次, 第二个参数index 为总时间,单位秒,block代码块,每秒执行一个,当总时间小于0时广告移除
[[[RACSignal interval:1 onScheduler:[RACScheduler mainThreadScheduler]] take:index] subscribeNext:^(id x) {
[btn setTitle:[NSString stringWithFormat:@"%ld 跳过",index] forState:UIControlStateNormal];
index --;
LxDBAnyVar(index);
if (index <= 0) {
[fullView removeFromSuperview];
}
}];
// 跳过按钮 的监听方法,点击跳过,即移除view
[[btn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
[fullView removeFromSuperview];
}];
demo:https://github.com/cailingyun2010/CYPushImageManager
网友评论