1 00:00:00,530 --> 00:00:01,710 So well come back. 2 00:00:01,760 --> 00:00:09,530 Statues are a way for us to organize our different items inside a stack of items and they're actually 3 00:00:09,530 --> 00:00:15,310 very very helpful in a lot of different locations so let me go to school. 4 00:00:16,190 --> 00:00:27,460 I'm going to start a new project here called sativus is that we use and then I'm going to jump immediately 5 00:00:27,460 --> 00:00:30,070 into the storyboard. 6 00:00:30,070 --> 00:00:32,030 Now let's imagine a situation like this. 7 00:00:32,050 --> 00:00:34,640 I have a button down. 8 00:00:34,830 --> 00:00:41,400 But then it's going to be how more distinctive by going for it or so on. 9 00:00:41,760 --> 00:00:45,200 And then I have another one next to it and the other one. 10 00:00:45,420 --> 00:00:51,790 And for whatever reason I want all of them to be placed next to each other with the same gap between 11 00:00:51,790 --> 00:00:52,750 them. 12 00:00:52,750 --> 00:00:56,260 Obviously one way to do that would be if I go ahead to my dimensions. 13 00:00:56,270 --> 00:01:01,990 I read the values and I do a lot of you know mathematical calculations place them all them and then 14 00:01:01,990 --> 00:01:05,450 I start adding constructs and then there is a much easier way. 15 00:01:05,470 --> 00:01:07,570 And that is using a stack for you. 16 00:01:07,630 --> 00:01:13,270 So I want to go in here and say Give me a statue and I want a horizontal a side view of course I'm going 17 00:01:13,270 --> 00:01:15,620 to place my view here. 18 00:01:15,670 --> 00:01:21,770 Unfortunately there's no way to change its background color so you kind of have to look at it like this. 19 00:01:21,910 --> 00:01:27,400 And the reason for it is the stack is essentially a what we call a non drawing view. 20 00:01:27,550 --> 00:01:29,950 So it doesn't really have that draw frame. 21 00:01:30,070 --> 00:01:33,990 But you could actually see it using the anchors that are it. 22 00:01:34,030 --> 00:01:40,180 Now before I add any elements to it I have to set the constraints for it and when I say let's say the 23 00:01:40,180 --> 00:01:46,090 height of it is always going to be let's say one hundred twenty eight. 24 00:01:46,270 --> 00:01:52,120 Let's say it is going to be vertically centered in my screen. 25 00:01:52,120 --> 00:01:59,690 Let's say it has a leading space of 10 of the trailing space of two or three a game. 26 00:01:59,980 --> 00:02:02,640 So this is going to be always here. 27 00:02:02,650 --> 00:02:06,510 I'm sorry if the four corners are not very easily detectable. 28 00:02:06,640 --> 00:02:10,410 Maybe if I change the back on it would be a little bit easier to see. 29 00:02:10,580 --> 00:02:17,710 So if this is like a ball didn't really have as much but but so these corners are very my style. 30 00:02:17,880 --> 00:02:18,780 You are now. 31 00:02:18,930 --> 00:02:22,510 I wish they could do is I could actually write my ball then drop it into it. 32 00:02:22,690 --> 00:02:25,250 And then it automatically fills the whole thing. 33 00:02:25,270 --> 00:02:30,220 Then there I another one and then choice two is spaced out one in and then another one. 34 00:02:30,490 --> 00:02:32,770 Now let me go ahead and rename my body. 35 00:02:32,780 --> 00:02:36,040 So this is by then 1 so I know what you're talking about. 36 00:02:36,040 --> 00:02:37,800 This is body and tool. 37 00:02:38,080 --> 00:02:41,060 And I'm going to call Dajuan to have a read thank. 38 00:02:41,090 --> 00:02:42,920 And this is Padan three. 39 00:02:43,120 --> 00:02:46,110 And that line has got a differing code as well. 40 00:02:46,330 --> 00:02:52,150 Now a stack of yours of very simple to deal with are there are a few ways that they would essentially 41 00:02:52,540 --> 00:02:54,130 distribute objects. 42 00:02:54,160 --> 00:02:57,770 One of them is the mode that we currently have this is called fill up. 43 00:02:58,030 --> 00:03:02,910 And then there's other mode that you usually want to use and that's called Fill equally. 44 00:03:02,950 --> 00:03:09,430 So they essentially get divided equally and then you can have a space between them that say 20 pixels 45 00:03:09,490 --> 00:03:11,320 or 20 units in here. 46 00:03:11,560 --> 00:03:18,310 So using that you can simply set your objects to be always in this particular situation irrelevant of 47 00:03:18,310 --> 00:03:25,130 the orientation because the stack is going to adjust itself I'm going to adjust its children in there. 48 00:03:25,570 --> 00:03:28,720 That's one way of making a stacked views. 49 00:03:28,840 --> 00:03:29,400 To be honest. 50 00:03:29,400 --> 00:03:35,710 My preferred way because I had the other two sets my constraints first and then worry about the content. 51 00:03:35,710 --> 00:03:41,830 There's also another way which is you would actually have a group of objects and then embed them inside 52 00:03:41,840 --> 00:03:42,580 this like view. 53 00:03:42,610 --> 00:03:44,330 So I'm going to go ahead and do that. 54 00:03:44,350 --> 00:03:46,890 Actually let me drive the three buttons out. 55 00:03:47,260 --> 00:03:48,550 So we have the table. 56 00:03:48,630 --> 00:03:50,960 They're just you know randomly sitting on it. 57 00:03:51,070 --> 00:03:53,620 And then I don't have the time for you anymore. 58 00:03:53,620 --> 00:04:00,570 I'm going to select the three buttons and then go down here and say embed inside a side view. 59 00:04:00,860 --> 00:04:05,950 And this is going to try to use its best judgment to decide whether it has to be a horizontal one or 60 00:04:05,960 --> 00:04:06,890 a vertical line. 61 00:04:06,910 --> 00:04:10,400 You made a mistake and that wasn't the orientation you wanted. 62 00:04:10,510 --> 00:04:16,920 You could simply go ahead to the axis and say change it to a vertical challenge with this Maudie's. 63 00:04:16,930 --> 00:04:19,590 Now you have to still set the constraints. 64 00:04:19,600 --> 00:04:27,160 So for instance I'm going to say there's a constraint to the top and from the top is always to say 40 65 00:04:27,740 --> 00:04:30,970 are on there and then I'm going to set another constraint. 66 00:04:30,970 --> 00:04:36,430 Let's say at the bottom I'm going to say from the bottom is always again 40. 67 00:04:36,520 --> 00:04:39,300 So that's kind of how it looks like. 68 00:04:39,520 --> 00:04:42,790 And then maybe I'm going to have another one say vet. 69 00:04:42,790 --> 00:04:50,530 The vet is always going to be let's say 96 and then I'm going to go ahead and say that is a leading 70 00:04:50,710 --> 00:04:51,720 face as well. 71 00:04:51,880 --> 00:05:00,640 So now my statue is properly adjusting itself to the top left bottom as well as having a particular 72 00:05:00,640 --> 00:05:01,480 vet. 73 00:05:01,600 --> 00:05:07,720 So I know that we have three items inside our stack few and a few is vertical we can actually see another 74 00:05:07,760 --> 00:05:09,980 attribute of it and that's the alignment. 75 00:05:10,150 --> 00:05:16,940 So if I go and change the distribution to feel equally is going to fill it equally based on the orientation 76 00:05:16,940 --> 00:05:22,000 of the axis you said but the alignment effect is not going to change they're going to be using their 77 00:05:22,090 --> 00:05:27,190 intrinsic value which is the value of the tend to place themselves. 78 00:05:27,330 --> 00:05:35,070 For instance if my but then one had a longer text longer text would take more space than the rest of 79 00:05:35,070 --> 00:05:40,390 them so I could easily go to a few and say the alignment is all so fit. 80 00:05:40,500 --> 00:05:47,010 So make sure you have it both ways both in terms of the leading space and the alignment as well as the 81 00:05:47,010 --> 00:05:48,780 distribution between them. 82 00:05:48,980 --> 00:05:51,610 And I'm with you with a space of say 20 again. 83 00:05:51,750 --> 00:05:53,700 And that's all there is to us. 84 00:05:53,700 --> 00:05:54,320 Thank you. 85 00:05:54,330 --> 00:06:01,170 You can see that there is going to be so many many situations very you need as each of you simply because 86 00:06:01,370 --> 00:06:08,160 as night falls they allow you to have equally spaced objects or if you want to make them based on their 87 00:06:08,820 --> 00:06:16,150 content proportionately or if you want to make them based on equal space between them so on and so forth 88 00:06:16,150 --> 00:06:21,270 there's so many many situations where I know all the other developers. 89 00:06:21,270 --> 00:06:22,710 They use a statues. 90 00:06:22,860 --> 00:06:26,900 So I'll give it a shot and it's a very simple thing to use. 91 00:06:26,910 --> 00:06:29,740 But you know just make sure that you have a good grasp over it. 92 00:06:30,030 --> 00:06:31,650 And then we move on to our next lesson.