这是一个UISlider
子类,模仿了Twitter的#music应用中发现的出色EQ滑动条。原因是我的朋友一直这样称呼它——而且我真的想不出更好的名字。
您需要为自己提供框架、音轨和滑动块的手势,或者只需使用我在示例项目中创建的——我不关心。我包括了PSD文件。
请原谅糟糕的GIF屏幕截图质量,性能相当好,动画中没有间隙。
界面非常简单
/** The value for the left channel eq in the range of 0 to 1.
@warning This value is clipped at 1.
*/
@property (nonatomic, assign) CGFloat leftChannelLevel;
/** The value for the right channel eq in the range of 0 to 1.
@warning This value is clipped at 1.
*/
@property (nonatomic, assign) CGFloat rightChannelLevel;
/** The inactive color for the eq. This is the color that the eq light takes on past the right side of the slider thumb knob.
*/
@property (nonatomic, strong) UIColor *inactiveColor;
/** The active color for the eq when it is available to be lit up. This is the color that the eq light takes on before the slider thumb knob.
*/
@property (nonatomic, strong) UIColor *activeColor;
/** The EQ light glow colors. The number of light sections the light takes on depends on how many colors you pass in here.
*/
@property (nonatomic, copy) NSArray *glowColors;
除了以上所有功能,由于这只是一个 UISlider
子类,您可以将其视为一个正常的 UISlider
来使用(使用 UIAppearance
等)。
MIT许可证。尽情享受吧。
如果您现在不在github上阅读这篇文章,您可以在以下页面找到它: https://github.com/larsacus/LARSBar
示例项目使用Novocaine进行音频输入。除此之外——祝您玩得开心。
真诚地,
Lars (@theonlylars)