Skip to content

Commit

Permalink
Disable longpress actions on textfields without caret
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshinejr committed Feb 1, 2021
1 parent 79dc30f commit 52f5de9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Tree Tracker

## Next
- Disabled longpress actions on textfields without caret (paste etc.)


## 0.2.0
- Added count of trees to upload on the list.
- Added ability to remove trees from the upload list (edit tree -> trash icon)
Expand Down
8 changes: 8 additions & 0 deletions Tree Tracker/UI/TextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ final class TextField: UITextField, UITextFieldDelegate {
}
}

override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
if isCaretHidden {
return false
} else {
return super.canPerformAction(action, withSender: sender)
}
}

func textFieldShouldReturn(_ textField: UITextField) -> Bool {
resignFirstResponder()
return true
Expand Down

0 comments on commit 52f5de9

Please sign in to comment.