0

我正在开发一个应用程序。在该应用程序中,我使用具有 10 个值的选择器视图。每当我向下滚动选择器时,在选择器弯下最后一个值后将被选中,并且 selectrow 将被触发。但我不想要那个,我需要选择我要选择的那个。所以请告诉我如何做那个。

4

1 回答 1

0

有一种UIPickerViewDelegate方法可以为您提供选定的行:

-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row
inComponent:(NSInteger)component
{
        float rate = [[exchangeRates objectAtIndex:row] floatValue];
        float dollars = [dollarText.text floatValue];
        float result = dollars * rate;

        NSString *resultString = [[NSString alloc] initWithFormat:
        @"%.2f USD = %.2f %@", dollars, result,
               [countryNames objectAtIndex:row]];
        resultLabel.text = resultString;
}

这可能是正确的链接单击此处查看您的问题。

于 2012-05-14T14:00:48.617 回答