- (void)tableView:(UITableView *)table didSelectRowAtIndexPath:(NSIndexPath *)newIndexPath {
// When a new selection is made, display a check mark on the newly-selected time signature and remove check mark from old time signature.
MetronomeAppDelegate *appDelegate = (MetronomeAppDelegate *)[[UIApplication sharedApplication] delegate];
NSIndexPath *oldIndexPath = [NSIndexPath indexPathForRow:([appDelegate timeSignature] - 2) inSection:0];
[[table cellForRowAtIndexPath:oldIndexPath] setAccessoryType:UITableViewCellAccessoryNone];
[[table cellForRowAtIndexPath:newIndexPath] setAccessoryType:UITableViewCellAccessoryCheckmark];
[table deselectRowAtIndexPath:newIndexPath animated:YES];
if (newIndexPath.row == 0) {
[appDelegate setTimeSignature:TimeSignatureTwoFour];
}
else if (newIndexPath.row == 1) {
[appDelegate setTimeSignature:TimeSignatureThreeFour];
}
else {
[appDelegate setTimeSignature:TimeSignatureFourFour];
}
}
No comments:
Post a Comment