开发者

Audio player using UITableView

开发者 https://www.devze.com 2023-03-09 11:49 出处:网络
I would like to create an audio player using UITableView. Every song needs to be a row in this table view controller and I expect every cell to have a play/stop button (only two states). I am managing

I would like to create an audio player using UITableView. Every song needs to be a row in this table view controller and I expect every cell to have a play/stop button (only two states). I am managing all the audio meta-data using Core Data and actually storing t开发者_Go百科he song files inside the sandbox (this is a demo application). Which is the best way to go about it? How can I have dynamic content inside UITableViewCells?

Any help is highly appreciated!

Thanks Ravi


  1. Subclass UITableViewCell to create two buttons inside of your cells.
  2. Assign them actions in the controller for the tableView, and check the indexPath (or a custom identifier assigned to the cell, but that wouldn't be very mvc aware...) of the cells that were toggled to know what sound to play.

    • Be careful with how the cells are reused to know what state to display.
0

精彩评论

暂无评论...
验证码 换一张
取 消