如果您使用选择器视图那就试试这个:
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
return 3;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
if(row == 0)
{
return @"Station 1";
}
else if(row == 1)
{
return @"Station 2";
}
else if (row==2)
{
return @"Station 3";
}
return @"";
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
if(row == 0)
{
self.int_Stationid = 1;
}
else if(row == 1)
{
self.int_Stationid = 2;
}
else if (row==2)
{
self.int_Stationid = 3;
}
}
这将是巨大的,有一些代码的工作。你还应该编辑你的问题,有点不清楚。 – danypata