解决 textFieldShouldReturn is not called

make sure you implement the UITextFieldDelegate and set your UITextField delegate to self. In your .h file:

@interface gameOverMenu : UIView <UITextFieldDelegate>

And somewhere in your .m file (viewDidLoad: maybe):

self.yourTextField.delegate = self;

Now your -(BOOL)textFieldShouldReturn:(UITextField *)textField method should be called.

你可能感兴趣的:(ios)