如何从UIpickerView中选择特定的值 [英] how to select the specific value from UIpickerView

查看:61
本文介绍了如何从UIpickerView中选择特定的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序.在该应用程序中,我使用带有10个值的选取器视图.每当我向下滚动选取器时,在选取器弯下腰之后,将选择最后一个值,并且会触发selectrow.但是我不希望那样一个,我需要选择我要选择的一个.所以请告诉我该怎么做.

i am developing one application.In that iam using the picker view with 10 values.Whenever i scroll the picker to down,after picker stooping last values will be selected and did selectrow will be fired.But i don't want that one,i need to select which one i want to select.So please tell me how to do that one.

推荐答案

UIPickerViewDelegate 方法可为您提供选定的行:

There is UIPickerViewDelegate Method which gives you the selected row:

-(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;
}

这可能是正确的链接单击此处来提问.

This could be proper link Click here for your question.

这篇关于如何从UIpickerView中选择特定的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆