UIPickerView
您可以使用...访问 SELECTED 值
- (NSInteger)selectedRowInComponent:(NSInteger)component
下面我描述了如何从中获取选定值的基本步骤UIPickerView
。
NSInteger selctedRow;
selctedRow = [myPickerView selectedRowInComponent:0];
NSString *strValue = [myArrayOfPickerView objectAtIndex:selctedRow];
[myButtonName setTitle:strValue forState:UIControlStateNormal];
或者
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
NSString *strValue = [myArrayOfPickerView objectAtIndex:Row];
[myButtonName setTitle:strValue forState:UIControlStateNormal];
}