 
     }
     
+    // MARK: - UIScrollViewDelegate
+
+    func scrollViewWillBeginDragging(scrollView: UIScrollView) {
+        if visiblePickerIndexPath != nil {
+            let dateCell: DatePickerCell = tableView.cellForRowAtIndexPath(self.visiblePickerIndexPath!) as! DatePickerCell
+            dateCell.setExpanded(false, animated: true)
+            visiblePickerIndexPath = nil
+            tableView.beginUpdates()
+            tableView.endUpdates()
+        }
+    }
+
     // MARK: - Helpers
     
     func cellType(forIndexPath indexPath: NSIndexPath) -> CellType {

        // Populate GUI for this baby
        self.familyNameTextField.text = self.baby?.familyName
        self.givenNameTextField.text = self.baby?.givenName
    }
    
    

        }
    }
    
    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {

        switch cellType(forIndexPath: indexPath) {
