1 00:00:00,260 --> 00:00:03,840 Solar come back this is going to be a very simple one. 2 00:00:03,840 --> 00:00:10,850 It is a way for us to make you own gestures inside our code rather than doing them in Interface Builder. 3 00:00:10,850 --> 00:00:16,290 And there are a lot of reasons why you want to do that simply because in a lot of situations you don't 4 00:00:16,290 --> 00:00:18,570 know what your objects are going to be. 5 00:00:18,750 --> 00:00:26,040 Let's say you want to have so many you swipe gestures attached to cells of a table view for instance 6 00:00:26,340 --> 00:00:30,680 you don't know that how many cells are going to be and you don't really have access to those. 7 00:00:30,720 --> 00:00:35,750 So it really makes sense that you do these kind of things in the code that not only makes sense. 8 00:00:35,760 --> 00:00:37,720 It's kind of the only way. 9 00:00:37,920 --> 00:00:39,410 So that's going to exclude. 10 00:00:39,750 --> 00:00:44,700 And I'm going to add a new app called just Shearer's forth. 11 00:00:45,040 --> 00:00:49,540 And like I said it's going to be very simple because we have seen all of this before. 12 00:00:50,760 --> 00:00:57,930 I a year I'm going to go ahead and say in my view that lot for instance or any one else I have let this 13 00:00:58,000 --> 00:01:03,180 small Let's make this one a long one my long gesture. 14 00:01:03,370 --> 00:01:10,530 Not long long just that's going to be a while longer press just should recognizer. 15 00:01:10,810 --> 00:01:17,620 And they always have to follow these tools simply because that is from the you I just sure recognize 16 00:01:17,770 --> 00:01:19,950 the parent class of all of them. 17 00:01:20,170 --> 00:01:26,720 Target is up and the selector is going to have an action just yet. 18 00:01:26,720 --> 00:01:36,120 So I'm going to say function it just shows function no parameters and no return type obviously or from 19 00:01:36,140 --> 00:01:36,710 now. 20 00:01:36,940 --> 00:01:44,270 So does that just shows function which means every time a long press is detected it's going to go run 21 00:01:44,380 --> 00:01:45,340 this function. 22 00:01:45,340 --> 00:01:50,570 Of course I forgot to add the Objective-C exposure. 23 00:01:50,660 --> 00:01:53,120 Now that part is taken care of. 24 00:01:53,140 --> 00:01:59,860 Now what we have to do the very last thing in here essentially is adding this just shift to someone 25 00:02:00,640 --> 00:02:06,640 your view or your cell of your table view the block on your game or whatever you're trying to do. 26 00:02:06,670 --> 00:02:15,040 So for now I'm going to say self don't view and just show recognizers my long gesture and that's about 27 00:02:15,050 --> 00:02:15,750 that. 28 00:02:15,760 --> 00:02:23,550 Now you have made a gesture recognizer inside the body of your court course if you wanted to do it actually 29 00:02:23,800 --> 00:02:29,640 add something in here save Prince lawing press. 30 00:02:29,990 --> 00:02:31,060 That's about that. 31 00:02:31,180 --> 00:02:37,960 I'm going to run the court and now that this simulator is up if I going yeah and say I hold the ball 32 00:02:37,960 --> 00:02:38,890 then boom. 33 00:02:38,950 --> 00:02:40,670 Long pressed. 34 00:02:40,810 --> 00:02:41,970 So that's about it. 35 00:02:41,980 --> 00:02:44,880 Very simple very simple lesson. 36 00:02:45,010 --> 00:02:50,250 Adding a just sure that is inside the court and you add them on your different objects. 37 00:02:50,260 --> 00:02:58,870 If for instance you had a lead red box being a you or you view if you had not then you could say red 38 00:02:58,870 --> 00:03:04,110 box does that or whatever is the object that you want to use it on. 39 00:03:04,180 --> 00:03:08,220 So we'll push just find yourself that view. 40 00:03:08,620 --> 00:03:10,510 And I don't need that for now. 41 00:03:10,870 --> 00:03:12,080 So that's about that. 42 00:03:12,130 --> 00:03:13,510 And I see you in the next lesson.