// When row is selected
- (void)pickerView:(UIPickerView *)pickerTimer didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
int minutes;
int seconds;
if (component == 0) {
if (row < 0){
minutes = row;
} else {
minutes = 0;
}
}
if (component == 1) {
if (row < 0){
seconds = row;
} else {
seconds = 0;
}
}
NSLog([NSString stringWithFormat:@"%f %f %d", minutes, seconds, row]);
if (minutes != 0 && seconds != 0){
[buttonTimer setTitle:[NSString stringWithFormat:@"%@ minutes and %@ seconds", minutes, seconds] forState:UIControlStateNormal];
// Yes, I am trying to set the label of a button.
}
if (minutes == 0 && seconds != 0){
[buttonTimer setTitle:[NSString stringWithFormat:@"%@ seconds", seconds] forState:UIControlStateNormal];
}
if (minutes != 0 && seconds == 0){
[buttonTimer setTitle:[NSString stringWithFormat:@"%@ minutes", minutes] forState:UIControlStateNormal];
}
if (minutes == 0 && seconds == 0){
[buttonTimerFarts setTitle:[NSString stringWithFormat:@"Set time before play starts..."] forState:UIControlStateNormal];
}
}
La console affiche des choses telles quePouvez-vous voir quelque chose de mal dans ce code? Parce que je ne peux pas, mais il ne fonctionne toujours pas
0.000000 -1.993950 2751746
Les trois premiers si (minutes secondes) déclarations, ne fonctionne jamais.
Alors, pouvez-vous voir quelque chose de mal?