从UIPickerView获取选定的值

时间:2014-02-05 04:51:04

标签: ios objective-c uipickerview

正如我的标题所说,我怎样才能从UIPickerView获得选定的价值? 它是否遵循委托方法用于实现或不建议我?

- (void)pickerView:(UIPickerView *)pickerView didSelectRow: (NSInteger)row inComponent:(NSInteger)component

1 个答案:

答案 0 :(得分:2)

您可以通过

UIPickerView中获取选定的值
NSString *selValue = [myArrayList objectAtIndex:[_myPickerView selectedRowInComponent:N]] // Here "N" is component like 0 or whatever.
NSLog (@"%@", selValue);