The first thing you want to study about touches or tormenter It's called the begin and touches.
And that actually is rather simple.
So let me go to Rick Scott and I'm going to start the new application.
I'm going to call them torches began and ended.
So let's assume I have something in my head.
Very simple.
You I view and there is that I use the you I view one not any other kind of object even though they
all almost work similarly Is that your views by default.
They have their user interaction enabled.
So if you have an object then you are trying to interact with and you're trying to tap into tagine and
that doesn't work.
Make sure that you have the user interaction enabled that is not enabled by default for some of the
objects such as you or image view.
But for a view it is by default virtually simplifies what I'm doing right now.
I also got to go ahead an other outlet for this.
So that's something you know we know we should be doing this out of there's going to be red box and
that's all I'm going to do in my interface.
So here I don't need to view that lot.
The only methods I need are all my tools that are members of the UI kit.
So I could have them built into it.
One of them is called touches began.
And the other one is called touches.
And as you can see we have two other ones has moved on.
Can we talk about it in our next lesson.
So this one is pouches and let me reformat everything so I can show them to you easier and tray to myself
easier.
So what happens is that whenever a touch lands on the surface of your iPhone this method gets called
and whenever a touch leaves your surface.
This one gets called.
Now do something really really simple and easy.
I'm going to have to say if I touched this red box remove it from the screen I simple as that.
So the first thing is I'm going to say Let my touch to become touches first.
So there is a set of different touches that might have landed or leaving the screen.
In this case and I'm going to get the fake first one of those.
So I'm going to get the one off the touches then I'm going to say if my torch view is a red box if I
have touched under the box because otherwise I don't want to do something.
Now let me show you a little trick that you could do something else you could do and that is if you
want to touch a variety of different options objects you could say if might touch view is not self view.
But for now we don't care about that.
We care about the red box.
So if might touch view is the red box here is what you want I want to say red box does that remove from
superb.
And that's pretty much all there is to it.
If you want they put right something in the touches began as I like to say clean touch land.
So we know when it touch lands and when something happens let's go ahead and run this up on our simulator.
So now I'm going to show you what gets printed in my console because if I touch somewhere outside the
red box is still something should be printed because the touches began doesn't test to see which you
are on.
So if it happened yet it says to touch land at the top again it says a touch on that.
But the very top under it it says a touch on that.
You can see it but then instead of holding the mouse button and not letting go of it it's as if I have
pressed put a touch on the device and I'm not letting go of it.
The moment they let go of it it removes it simply because when I said that it did the same.
It says if my touch was was removed from Superbia.
So that's about the very basics of using touches of this very limited you know introduction.
There is still so much you can do a lot of you know simple games you can develop you can do things that
are about the number of touches you can count the time between different touches so on and so forth.
So let's keep it up to here and move on to our next lesson.