Created
February 18, 2016 02:42
-
-
Save ktanaka117/675e94cfdbbb6868aa1e to your computer and use it in GitHub Desktop.
This file contains 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
import UIKit | |
// !!! プロトコルの採用とDelegateのセット忘れでつまづく(※ここではStoryboard上でVCと紐付けています) !!! | |
// textField.delegate = selfのことです。 | |
class ViewController: UIViewController, UITextFieldDelegate { | |
@IBOutlet weak var textField: UITextField! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} | |
// !!! 複数のDelegateメソッドがある際に処理の順序が追いづらい !!! | |
func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool { | |
print(string) | |
return true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment