mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-06-04 19:43:31 +08:00
Enable/Disable New issue submit button based on title text (#519)
* Enable/Disable New issue submit button based on title text (#518) * Remove target when deinit * Adds check for title field empty text * Uses IBAction instead of adding target
This commit is contained in:
committed by
Ryan Nystrom
parent
8c0bcc7d6f
commit
5b195e931b
@@ -34,6 +34,9 @@
|
||||
<nil key="textColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
|
||||
<connections>
|
||||
<action selector="titleFieldEditingChanged:" destination="dCJ-7J-GVo" eventType="editingChanged" id="vFb-te-qq8"/>
|
||||
</connections>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
|
||||
@@ -123,6 +123,7 @@ final class NewIssueTableViewController: UITableViewController, UITextFieldDeleg
|
||||
target: self,
|
||||
action: #selector(onSend)
|
||||
)
|
||||
navigationItem.rightBarButtonItem?.isEnabled = false
|
||||
}
|
||||
|
||||
/// Attempts to sends the current forms information to GitHub, on success will redirect the user to the new issue
|
||||
@@ -189,5 +190,12 @@ final class NewIssueTableViewController: UITableViewController, UITextFieldDeleg
|
||||
bodyField.becomeFirstResponder()
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
// MARK: Actions
|
||||
|
||||
/// Called when editing changed on the title field, enable/disable submit button based on title text
|
||||
@IBAction func titleFieldEditingChanged(_ sender: Any) {
|
||||
navigationItem.rightBarButtonItem?.isEnabled = titleText != nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user