InteractivePlayerView

加入收藏
已有 4 人收藏

介绍:
    自定义的一个播放器视图。参照了 pin 上的设计图。

    有播放、暂停、上一首,下一首的功能按键,有一个圆弧形的播放进度条。

    

    使用方法:

    1、storyboard中添加自己设置好的的 view

    2、将自己设置的 view 的 class 设置为 InteractivePlayerView

    3、设置属性和初始化方法等就可以正常使用了。

    @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()

    

     // restart player with duration

     self.ipv.restartWithProgress(duration: 50)

    

     /* 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")

    

     }

测试环境:
  [Code4App]编译测试
效果图:
  • iOS / iPhone / iPad 自定义的一个播放器视图。参照了 pin 上的设计图。<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;有播放、暂停、上一首,下一首的功能按键,有一个圆弧形的播放进度条。<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;使用方法:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;1、storyboard中添加自己设置好的的 view<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;2、将自己设置的 view 的 class 设置为 InteractivePlayerView<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;3、设置属性和初始化方法等就可以正常使用了。<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;@IBOutlet var ipv: InteractivePlayerView!<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;// set delegation<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  self.ipv!.delegate = self<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  // duration of music<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  self.ipv.progress = 120.0<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  // start - stop player<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  self.ipv.start()<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  self.ipv.stop()<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  // restart player with duration<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  self.ipv.restartWithProgress(duration: 50)<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  /* InteractivePlayerViewDelegate METHODS */<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    func actionOneButtonTapped(sender: UIButton, isSelected: Bool) {<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;        println("ActionOneButton tapped")<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    func actionTwoButtonTapped(sender: UIButton, isSelected: Bool) {<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;        println("ActionTwoButton tapped")<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    func actionThreeButtonTapped(sender: UIButton, isSelected: Bool) {<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;        println("ActionThreeButton tapped")<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;    }
代码评论:
登录后方可评论

  
  • 暂无评论