Hi all,
I have a custom tableView in which each cell contains a UIButton. When I press the button of any cell I want to play a system sound for that particular cell.
(I set up the custom cell in a UITableViewCell subclass (NumbersDetailCell) )
The problem is that the sound plays as soon as the tableView loads and not when I press the button in the cell. Nothing happens when I press the button.
Its probably a stupid mistake but I just can't seem to figure it out. So any help is well appreciated!
I have a custom tableView in which each cell contains a UIButton. When I press the button of any cell I want to play a system sound for that particular cell.
(I set up the custom cell in a UITableViewCell subclass (NumbersDetailCell) )
- (UITableViewCell *)tableView: (UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath {
NumbersDetailCell *cell = (NumbersDetailCell *)[tableView dequeueReusableCellWithIdentifier"NumbersDetailC ell"];
if (cell == nil) {
cell = [[[NumbersDetailCell alloc] initWithFrame:CGRectZero reuseIdentifier"NumbersDetailCell"] autorelease];
cell.hidesAccessoryWhenEditing = NO;
}
if (indexPath.section == 0) {
cell.flag.image = [UIImage imageNamed"1.png"];
if (cell.sound.selected == TRUE)
AudioServicesPlaySystemSound (self.one);
}
if (indexPath.section == 1) {
cell.flag.image = [UIImage imageNamed"2.png"];
if (cell.sound.selected == TRUE)
AudioServicesPlaySystemSound (self.two);
}
//and so on...
The problem is that the sound plays as soon as the tableView loads and not when I press the button in the cell. Nothing happens when I press the button.
Its probably a stupid mistake but I just can't seem to figure it out. So any help is well appreciated!