实现播放器的断点播放有两个思路:
- 自定义进度条(使用
UIView
绘制) - 在
UISlider
基础上实现断点播放
在这里简单介绍下用第2中思路是怎么实现的
实现思路:
扩展一个UISlider
子类,在子类方法中重写开始触摸代理方法
1 | -(void)touchesBegan:(NSSet <UITouch *> *)touches withEvent:(UIEvent *)event |
代码实现:
1 | -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ |