2010-09-22 68 views
0

我目前正在开发一个应用程序,它会记录一些音频文件。 音频文件存储在本地,路径存储在核心数据中。TableViewCell,动态显示媒体播放器控件iPhone

我正在用录制的音频列表填充一个TableView。 当我点击tableviewcell时,我可以播放录制的声音。

我想在桌面视图上显示一些控件(如播放和暂停按钮与iPhone中的录音机应用程序相同),只有当用户选择表格单元格时才会显示该控件,并且当他选择其他单元格时将会消失。

任何参考,链接,可以帮助我的例子。这对我来说是非常迫切

问候 亚太区首席技术官Matt V

回答

0

如果实现的UITableViewCell,你就可以自定义单元格以自己的喜好。 您也可以使用方法 setSelected :(BOOL)选择动画:(BOOL)动画 根据选择的(或不选择)更改单元格。

0

编写代码以创建自定义UITableViewCell(动态)。你不会得到这个问题。

尝试使用下面的示例代码;

static NSString *CellIdentifier = @"Cell"; 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease]; 
} 
UIImageView *cellImageView1=[[UIImageView alloc]initWithFrame:CGRectMake(0,0,320,80)]; 
UIImage *cellImage1=[UIImage imageNamed:@"table_bar.png"]; 
cellImageView1.image=cellImage1; 
cell.backgroundView=cellImageView1; 
NSString *projectName = [projectNameArray objectAtIndex:indexPath.row]; 
cell.imageView.image=[self returnImage:projectName]; 
cell.imageView.frame=CGRectMake(10, 05, 40, 40); 
cell.imageView.image=[self returnImage:projectName]; 
UILabel *cellLabel=[[UILabel alloc] initWithFrame:CGRectMake(75, 15, 150, 30)]; 
cellLabel.text=projectName; 
cellLabel.backgroundColor=[UIColor clearColor]; 
cellLabel.textAlignment = UITextAlignmentLeft; 
cellLabel.tag = 4444; 
[cell.contentView addSubview:cellLabel]; 
[cellLabel release]; 
cell.accessoryView =(UIButton*) [buttonArray objectAtIndex:indexPath.row]; 
return cell;

我希望它能帮助你。