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

    //選択時
    func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
        
        if(pickerView.tag == 1){
            SaralyLabel.text = String(DBmethod().ShiftDBSaralyGet(DBmethod().DBRecordCount(ShiftDB)-1-row))
        }else if(pickerView.tag == 2){
            shiftgroupnametextfield.text = shiftgroupname[row]
            pickerdoneButton.tag = 2
        }else if(pickerView.tag == 3){
            
            if(component == 0){
                starttime = time[row]
            }else if(component == 2){
                endtime = time[row]
            }
            pickerdoneButton.tag = 3
            

        textField.placeholder = "シフトの時間を入力"
        textField.inputView = self.shifttimeUIPicker
        textField.inputAccessoryView = self.pickerviewtoolBar
        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]
        }
    }
}

