如何获取 a 的选定行的值uipickerview
?我使用代码有行值;
int row;
row = [PickerView selectedRowInComponent:0];// row value is ok
[object atIndex:row]; //is not working?
等待你的帮助?
更新:
实际上我想获取加载时默认选择的pickerview的值...
如何获取 a 的选定行的值uipickerview
?我使用代码有行值;
int row;
row = [PickerView selectedRowInComponent:0];// row value is ok
[object atIndex:row]; //is not working?
等待你的帮助?
更新:
实际上我想获取加载时默认选择的pickerview的值...
您可以使用它的委托方法。
- (void)pickerView:(UIPickerView *)pickerView didSelectRow: (NSInteger)row inComponent:(NSInteger)component {
[object atIndex:row];
}
我想你想要这个
NSInteger selectedRow =[self.singlePicker selectedRowInComponent:0];
NSString *title = [self.data objectAtIndex: selectedRow];