如果您使用選擇器視圖那就試試這個:
- (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