         textField.placeholder = "シフトの時間を入力"
         textField.inputView = self.shifttimeUIPicker
         textField.inputAccessoryView = self.pickerviewtoolBar
-        textField.tag = 0
+        textField.tag = 2
         textField.delegate = self
         shifttimetextfield = textField
     }
+    
+    //シフトグループ,シフト時間(開始),シフト時間(終了)の選択箇所を記録する変数
+    var shiftgroupselectrow = 0
+    var shiftstarttimeselectrow = 0
+    var shiftendtimeselectrow = 0
+    
+    //textfieldがタップされた時
+    func textFieldDidBeginEditing(textField: UITextField) {
+        if(textField.tag == 1){             //シフトグループ選択
+            shiftgroupnameUIPicker.selectRow(shiftgroupselectrow, inComponent: 0, animated: true)
+            textField.text = shiftgroupname[shiftgroupselectrow]
+            
+        }else if(textField.tag == 2){       //シフト時間選択
+            shifttimeUIPicker.selectRow(shiftstarttimeselectrow, inComponent: 0, animated: true)
+            shifttimeUIPicker.selectRow(shiftendtimeselectrow, inComponent: 2, animated: true)
+            textField.text = time[shiftstarttimeselectrow] + " " + wavyline[0] + " " + time[shiftendtimeselectrow]
+        }
+    }
 }
 

            
            //シフト名,シフトグループ名の場所にカーソルがある時はボタンを有効にする
            switch(textField.tag){
            case 1:
                return true
            default:
                return false

        alert.addTextFieldWithConfigurationHandler({(text:UITextField!) -> Void in
            text.placeholder = "シフトの名前を入力"
            text.returnKeyType = .Next
            text.tag = 0
            text.delegate = self
        })
        
