我有 UITableview
uitableview 包含播放列表音频歌曲,我在单元格中放了一个按钮。
用户单击行音频开始播放
我想要,当用户单击仅行按钮时应该启用,而单元格应该被禁用
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSURL *url = [[NSURL alloc]initFileURLWithPath:soundsPath];
NSURL * playurl =[NSURL URLWithString:[passarray objectAtIndex:indexPath.row] relativeToURL:url];
if (indexPath.row ==1) {
buybtn.userInteractionEnabled=YES;
cell.contentView.userInteractionEnabled=YES;
buybtn.showsTouchWhenHighlighted=YES;
}
player = [[AVAudioPlayer alloc] initWithContentsOfURL:playurl error:nil];
[self.player play];
player.delegate = self;
cell =[tableView cellForRowAtIndexPath:indexPath];
cellText = cell.textLabel.text;
lbl.text=cellText;
}