1 00:00:01,320 --> 00:00:02,570 So can I gain. 2 00:00:02,610 --> 00:00:09,900 This lesson is about adding a slider to your apps similar to you I switch. 3 00:00:09,900 --> 00:00:13,660 This is going to be a very simple project as well. 4 00:00:13,830 --> 00:00:20,910 So let's jump into ex-cult in here I'm going to start a new project single view application the slider 5 00:00:20,940 --> 00:00:26,310 app is only a few things that one needs to learn about the Sneider. 6 00:00:26,490 --> 00:00:29,520 So the first thing is I'm going to go Ptomaine to the storyboard. 7 00:00:29,520 --> 00:00:31,380 I'm going to add this slider. 8 00:00:31,410 --> 00:00:38,740 So this is a slider on a slide as they can have different vits to them on a slide. 9 00:00:38,750 --> 00:00:45,750 They have minimum and maximum and Crans values and these are other settings here for changing the looks 10 00:00:45,750 --> 00:00:55,500 of them but for me I'm only going to worry about 0 to 1 Sorry 0 to 100 and the current value is a 50. 11 00:00:55,590 --> 00:01:02,820 So it's some sort of like percentage a slider for me and then I'm going to have a label that shows me 12 00:01:02,820 --> 00:01:05,980 the result of my slider. 13 00:01:06,290 --> 00:01:08,630 I'm going to have that label in here. 14 00:01:09,190 --> 00:01:14,500 And like always I'm going to go with a different background color so I can actually see it. 15 00:01:14,670 --> 00:01:15,990 And that's about that. 16 00:01:15,990 --> 00:01:23,070 Now what they need is essentially one method and one outlet. 17 00:01:23,190 --> 00:01:28,600 So that's got to Assistant Director load up my H in my age. 18 00:01:28,620 --> 00:01:38,040 I'm going to go ahead and say this is let's call it let's slide it. 19 00:01:38,130 --> 00:01:39,680 This is my action. 20 00:01:39,750 --> 00:01:48,120 Let's slide that action and then I'm going to have a label that is called the label as I usually call 21 00:01:48,120 --> 00:01:48,790 it. 22 00:01:48,810 --> 00:01:50,220 So that's about that. 23 00:01:50,280 --> 00:01:59,960 That's all I have to do now when I move on to my ARE NOT am in my method. 24 00:02:00,000 --> 00:02:06,230 I'm going to say resonate when the text comes. 25 00:02:06,600 --> 00:02:09,880 Let's get our slide there which is from the center there. 26 00:02:09,910 --> 00:02:11,170 You remember that. 27 00:02:11,340 --> 00:02:21,520 So I'm going to say you lie a slider of sender dot value and that's a float value also if you want to 28 00:02:21,520 --> 00:02:25,090 pretend that text you have to get on a string from it. 29 00:02:25,310 --> 00:02:28,420 And then I say that's a string string with formats. 30 00:02:28,710 --> 00:02:34,560 What ever floats that you find in this neither. 31 00:02:34,830 --> 00:02:39,510 And that's about that's and we can run our application now. 32 00:02:39,540 --> 00:02:46,830 Keep something in mind that when we made our action automatically through the assistant editor it actually 33 00:02:46,830 --> 00:02:49,410 connected the two value changed. 34 00:02:49,410 --> 00:02:58,700 So every time in here value changed every time the horizontal slider changes its value then that's it 35 00:02:58,710 --> 00:03:03,420 we will get a new trigger of our function. 36 00:03:03,600 --> 00:03:08,130 So let's see perfect we can see it all there. 37 00:03:08,190 --> 00:03:16,320 And as you probably remember from the past we can format this flawed to show us let's say only two decimal 38 00:03:16,320 --> 00:03:18,560 points or two decimal places. 39 00:03:18,720 --> 00:03:22,420 So if I want to see only two of them I put a point or two in there. 40 00:03:22,420 --> 00:03:25,240 And now we only see point two of them. 41 00:03:25,420 --> 00:03:30,300 There is one more thing that I want to mention and that kind of from time to time has become useful 42 00:03:30,300 --> 00:03:35,430 for me and that is what I don't want to constantly see the results. 43 00:03:35,430 --> 00:03:39,540 What I want to see it only when I finish sliding. 44 00:03:39,540 --> 00:03:43,250 What if I don't want to see these changes now until I let go. 45 00:03:43,440 --> 00:03:49,290 And in here I want to see if there is a property for all the sliders which is called up. 46 00:03:49,320 --> 00:03:52,670 It is continuous or is continuous. 47 00:03:52,740 --> 00:03:59,730 So it is funny in here it says continuous updates so you can turn it off and now you feel really good 48 00:03:59,730 --> 00:04:00,030 on it. 49 00:04:00,030 --> 00:04:06,720 Now we should see without that constant change after you and I let go. 50 00:04:06,750 --> 00:04:08,930 It shows me that is when I let go. 51 00:04:08,930 --> 00:04:11,150 It shows me when I let's call it shows. 52 00:04:11,250 --> 00:04:11,850 Perfect. 53 00:04:11,850 --> 00:04:14,040 So that's about that. 54 00:04:14,040 --> 00:04:20,670 Like I said there's going to be a very short and a very simple up and when we slide it the value changed 55 00:04:20,670 --> 00:04:27,770 to get the slider you get less value become 32 to place this small floating value. 56 00:04:27,940 --> 00:04:31,630 And we make an interesting out of it and we show it in our label. 57 00:04:31,920 --> 00:04:33,410 So on CNN Expressen.