私はtableview
5行ありますが、行を選択するとUIPickerView
次のページでオプションを選択するために開きます。5行でも同じことが起こります。今、ピッカー値が必要です。特定の行(右側)に反映される必要があります。選択しました
選択した行の値(UIPicker値)を実行するためのボタンが同じページにあります。Button.toで取得した行の値を選択するためのオプションを指定する方法UIPicker
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row==0){
Picker1 *logInController = [[Picker1 alloc] init];
[[self navigationController] pushViewController:logInController animated:YES];
}
if(indexPath.row==1){
Picker2 *logInController = [[Picker2 alloc] init];
[[self navigationController] pushViewController:logInController animated:YES];
}
}
上記のように、を開いてUIPIcker
オプションを選択しました。
PICKER1.mで
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
// update label text to show selected option
NSString* string=[NSString stringWithFormat:@"you are selected %@",[list objectAtIndex:row]];
label.text=string;
}
- (void)viewDidLoad
{
[super viewDidLoad];
list =[[NSMutableArray alloc]init];
[list addObject:@"GPS"];
[list addObject:@"NONE"];
}