每个UITableViewCell播放不同的声音

时间:2012-03-23 11:54:55

标签: ios

我正在研究一个具有UITableView的记录器,我的记录将保存在NSDOcumenDirectory中,问题是当用户触摸每个单元格时它会播放所选择的recordFile。我应该如何填充DidSelectRowAtIndex部分,我不想使用开关,因为它对于有限的数据我想要一种无限数据的方式。

1 个答案:

答案 0 :(得分:0)

你可以在didselectrowatindex方法中使用像下面这样的switch-case方法:

switch(indexpath.row)
{
     case 1:
          // Code to Play sound 1
          break;

     case 2:
           // Code to Play sound 2
          break;

     ...
     case value N:
           // Code to Play sound N
          // Program statement
          ...
          break;

     default:
           // Code to Play default (if present)
          // Program statement
          ...
          break;
}
相关问题