-2

I'm beginner developer... I have NSUserDefaults to get UIPicker selection and a double value where to load selection of the UIPicker.

 NSUserDefaults *pickerViewSelectionDefaults = [NSUserDefaults standardUserDefaults];
        [pickerWork selectRow:[pickerViewSelectionDefaults integerForKey:@"pickerSelectionMinWork"] inComponent:0 animated:YES];

double dobMinute = [[NSString stringWithFormat:@"%f", [[minArray objectAtIndex:[pickerWork selectedRowInComponent:0]] floatValue]] doubleValue]*60;

How can I replace selectedRowInComponent: with selectRow:inComponent:animated: because I have this error:

Sending 'void' to parameter of incompatible type 'NSUInteger' (aka 'unsigned long')

Thanks in advance!

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Joannes
  • 1
  • 1

1 Answers1

0

change

  double dobMinute = [[NSString stringWithFormat:@"%f", [[minArray objectAtIndex:[pickerWork selectedRowInComponent:0]] floatValue]] doubleValue]*60;

to

double dobMinute = [pickerViewSelectionDefaults integerForKey:@"pickerSelectionMinWork"]*60;
tuledev
  • 10,177
  • 4
  • 29
  • 49
  • Because with only '[[minArray objectAtIndex:[pickerWork selectedRowInComponent:0]] floatValue]*60' I can't get NSUserDefaults value. Then I need a float for a countdown. https://www.dropbox.com/s/uemccj6urji0vud/error.png?dl=0 – Joannes Aug 18 '15 at 08:10
  • In your img, you didn't use "[pickerWork selectedRowInComponent:0]". You are using [pickerWork selectRow:[pickerViewSelectionDefaults integerForKey:@"pickerSelectionMinWork"] inComponent:0 animated:YES]. Change it. – tuledev Aug 18 '15 at 08:30
  • You ask me what line caused the error? I replaced [pickerWork selectedRowInComponent:0] with [pickerWork selectRow:[pickerViewSelectionDefaults integerForKey:@"pickerSelectionMinWork"] inComponent:0 animated:YES] to show you the error. I can't solve this error. – Joannes Aug 18 '15 at 08:41
  • It means [pickerWork selectedRowInComponent:0] cause error also?. [minArray objectAtIndex:....] this function need a int value. [pickerWork selectRow:[pickerViewSelectionDefaults integerForKey:@"pickerSelectionMinWork"] inComponent:0 animated:YES] doesn't return any value. So, you got the error for sure. – tuledev Aug 18 '15 at 08:56
  • Does "double dobMinute = [[NSString stringWithFormat:@"%f", [[minArray objectAtIndex:[pickerWork selectedRowInComponent:0]] floatValue]] doubleValue]*60;" cause any error? I don't understand what do you want. Can you make the problem clearly? – tuledev Aug 18 '15 at 09:00
  • "[[minArray objectAtIndex:[pickerWork selectedRowInComponent:0]] floatValue]*60" works! But I need to remember the picker selection with NSUserDefaults. So to select row I set selectRow:inComponent:animated: with selectRow:[pickerViewSelectionDefaults integerForKey:@"pickerSelectionMinWork"] instead of method selectedRowInComponent:0 – Joannes Aug 18 '15 at 09:19