This course will be retired on May 31, 2020.
Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Repositioning the Text Field1:20 with Pasan Premaratne
Let's take a look at my solution.
Okay, before we tackle our final bit of work let's take a look at the solution I
So first up I added an observer for the UI keyboardWillHide notification.
I'm not doing anything different here compared to what we did last time.
The only difference is we're passing in a new method, keyboardWillHide,
as the selector for the method for the observer method and a new notification
in this case that is UIKeyboardWillHide compared to UIKeyboardWillShow.
No that because the compiler knows that this is an argument of type
I didn't bother to write the whole thing out and
just using the convenient.notation to pass in just the notification name.
And the bottom, I have a new keyboardWillHide method and
all I'm doing is setting the constant on the constraint back to the original value
40, and then animating it just like before.
I don't need to call any new method in the deinit method of the ViewController and
that's because we're de-registering or
we are removing this class as an observer which means that it will be removed
as an observer for all notifications that we're observing.
If you run it you'll find that all of this should work.
You need to sign up for Treehouse in order to download course files.Sign up