iOS 音乐播放视图:InteractivePlayerView
jopen
9年前
InteractivePlayerView 是可以自定义的 iOS 音乐播放视图,一个IBDesignableView (自定义View) ,它拥有自己的进度条,封面和动作按纽。
用法
- Add your view in storyboard
- Arrange your view's size square (It looks better this way)
- Set your view's class InteractivePlayerView
- Wait until it built in storyboard and set variables
- Then create your property of view and set it's delegate to self to use it's delegation methods and good to go !
@IBOutlet var ipv: InteractivePlayerView! // set delegation self.ipv!.delegate = self // duration of music self.ipv.progress = 120.0 // start - stop player self.ipv.start() self.ipv.stop() /* InteractivePlayerViewDelegate METHODS */ func actionOneButtonTapped(sender: UIButton, isSelected: Bool) { println("ActionOneButton tapped") } func actionTwoButtonTapped(sender: UIButton, isSelected: Bool) { println("ActionTwoButton tapped") } func actionThreeButtonTapped(sender: UIButton, isSelected: Bool) { println("ActionThreeButton tapped") }