I figured out a workaround. If there is a better way of implementing this, I'd like to know. But if there is anyone who is also looking for this solution, here is how I did it.
I added a UITextView through the interface builder and checked the Hidden attribute in the view category under attribute inspector so that user doesn't activate the textfield by accident. Then:
func datePickerSetupTest() {
let dateView = UIView(frame: CGRectMake(0, 100, 320, 160))
datePicker = UIDatePicker(frame: CGRectMake(0, 0, 320, 160))
datePicker.datePickerMode = .Date
dateView.addSubview(datePicker)
inputTextField.inputView = dateView
let doneButton = UIButton (frame: CGRectMake(100, 100, 100, 44))
doneButton.setTitle("Done", forState: UIControlState.Normal)
doneButton.addTarget(self, action: "datePickerSelected", forControlEvents: UIControlEvents.TouchUpInside)
doneButton.backgroundColor = UIColor .blueColor()
inputTextField.inputAccessoryView = doneButton
}
func datePickerSelected() {
print("selectedRow: \(selectedRow!)")
inputTextField.resignFirstResponder()
}
and inside the UITableViewRowAction:
tableView.editing = false
self.selectedRow = indexPath.row
self.inputTextField.becomeFirstResponder()
I'm using the variable selectedView: Int? to pass the selected row to manipulate the data in that row.