     }
     
     var buttontilearray:[String] = []
+    var buttonobjectarray: [UIButton] = []
     
     func SetupDayButton(){
         
+        for i in 0..<buttonobjectarray.count {
+            buttonobjectarray[i].removeFromSuperview()
+        }
+        
         //ボタンのタイトルを日付から計算して生成する
-        let todaynsdate = self.ReturnYearMonthDayWeekday(NSDate())
-        self.SetDayArray(NSDate(),pivotweekday:todaynsdate.weekday)      //buttontilearrayへ値を格納する
+        let todaynsdate = self.ReturnYearMonthDayWeekday(currentnsdate)
+        self.SetDayArray(currentnsdate,pivotweekday:todaynsdate.weekday)      //buttontilearrayへ値を格納する
         
         for i in 0...6{
             

        CalenderLabel.text = "\(date.year)年\(date.month)月\(date.day)日 (\(self.ReturnWeekday(date.weekday)))"
        
        currentnsdate = today
    }
    
    func nextday(){

            //ボタンを配置する
            self.view.addSubview(button)
            self.view.bringSubviewToFront(button)
            
            buttonobjectarray.append(button)
        }
    }
    
