UUicker从NSUserDefaults中选择双值

时间:2015-08-18 07:36:23

标签: ios objective-c uipickerview uipickerviewcontroller

我是初学者...... 我有NSUserDefaults来获取UIPicker选项和双值来加载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;

如何将 selectedRowInComponent:替换为 selectRow:inComponent:animated:,因为我遇到此错误:

发送'无效'到不兼容类型的参数' NSUInteger' (又名' unsigned long')

提前致谢!

1 个答案:

答案 0 :(得分:0)

变化

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

double dobMinute = [pickerViewSelectionDefaults integerForKey:@"pickerSelectionMinWork"]*60;