             text.delegate = self
         })
         
-        //シフト体制グループ用のtextfieldを追加
-        alert.addTextFieldWithConfigurationHandler({ (text:UITextField!) -> Void in
-            text.placeholder = "シフトのグループを入力"
-//            text.returnKeyType = .Next
-            text.inputView = self.shiftgroupnameUIPicker
-            text.inputAccessoryView = self.pickerviewtoolBar
-            text.tag = 1
-            text.delegate = self
-        })
-        
-        //シフトの時間入力用のtextfieldを追加
-        alert.addTextFieldWithConfigurationHandler({ (text:UITextField!) -> Void in
-            text.placeholder = "シフトの時間を入力"
-            text.returnKeyType = .Next
-            text.inputView = self.shifttimeUIPicker
-            text.inputAccessoryView = self.pickerviewtoolBar
-            text.tag = 0
-            text.delegate = self
-        })
+        //シフトグループの選択内容を入れるテキストフィールドを追加
+        alert.addTextFieldWithConfigurationHandler(configurationshiftgroupnameTextField)
+
+        //シフト時間の選択内容を入れるテキストフィールドを追加
+        alert.addTextFieldWithConfigurationHandler(configurationshifttimeTextField)
+
         
         self.presentViewController(alert, animated: true, completion: nil)
     }

                let textFields:Array<UITextField>? =  alert.textFields as Array<UITextField>?
                if textFields != nil {
                    for textField:UITextField in textFields! {
                        //各textにアクセス
//                        print(textField.text)
                        
                        if(textField.text == ""){
                            flag = false

    var shifttimeUIPicker: UIPickerView = UIPickerView()
    var pickerviewtoolBar = UIToolbar()

    var shiftgroupnametextfield = UITextField()
    var shifttimetextfield = UITextField()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
