2010-09-22 42 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;

我希望它能幫助你。