Last active
March 30, 2016 06:35
-
-
Save groue/29f2aec9ec386ab9f6acfcc8fcc2a23e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // MARK: - Form | |
| extension PersonEditionViewController: UITextFieldDelegate { | |
| override func viewWillAppear(animated: Bool) { | |
| super.viewWillAppear(animated) | |
| nameTextField.becomeFirstResponder() | |
| } | |
| override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { | |
| tableView.deselectRowAtIndexPath(indexPath, animated: false) | |
| let cell = tableView.cellForRowAtIndexPath(indexPath) | |
| if cell === nameCell { | |
| nameTextField.becomeFirstResponder() | |
| } else if cell === scoreCell { | |
| scoreTextField.becomeFirstResponder() | |
| } | |
| } | |
| func textFieldShouldReturn(textField: UITextField) -> Bool { | |
| if textField == nameTextField { | |
| scoreTextField.becomeFirstResponder() | |
| } | |
| return false | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment