Apple iOS tutorial not working correctly, what did I miss?

I follow this iPhone tutorial from Apple , and I think I did everything right, however the application does not behave as it should. I checked the troubleshooting section and I still think everything is fine with me.

So, I think I need help to tell where the problem is ... here is a snapshot of the corresponding connections in Interface Builder.

Basically, the Finish button on the keyboard does not cancel the keyboard, and the Hello button on the view does not call the changeGreeting method.

If you can’t say what is missing, just ask me to post some code or something else. Thank!

IB connections

This is in the controller:

- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
    if (theTextField == textField) {
        [textField resignFirstResponder];
    }

    return YES;
}

: , nib, , . !

+3
3

, , , nib... , , .

, :

Files Owner connections

, , , . , .

0

"ResignFirstResponder" textFieldShouldReturn:? , , , . " " .

+1

. - :

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder]; 
    return YES; 
}

To reject a text field, you need to implement a UITextFieldDelegate . Sounds like an annoying default to me, but it should be done!

+1
source

Source: https://habr.com/ru/post/1759782/


All Articles