1
00:00:00,150 --> 00:00:01,450
So I come back again.

2
00:00:01,470 --> 00:00:03,770
This lesson is going to be a very simple one.

3
00:00:03,770 --> 00:00:07,050
I'm going to show you how to use a progress you.

4
00:00:07,290 --> 00:00:13,050
The only thing I'm not going to show you in here is how to actually connect a progress view to something

5
00:00:13,050 --> 00:00:17,300
that is happening on a network because that's most often what you use.

6
00:00:17,340 --> 00:00:23,790
Progress view for the use it for reading values from a network or making sure something is happening

7
00:00:23,790 --> 00:00:26,230
successfully on our application.

8
00:00:26,340 --> 00:00:33,910
Something that looks cold and let us start a new project called Progress view.

9
00:00:34,260 --> 00:00:43,990
And for now if only going to use it for everything and then I'm going over to my storyboard say give

10
00:00:43,990 --> 00:00:52,500
me a progress view in here and there's a lot of you know set things that you can have for progress views

11
00:00:52,500 --> 00:00:59,110
such as the track color or the progress color a style whether you want to be a board that doesn't have

12
00:00:59,110 --> 00:01:06,230
the empty Tricor over there you want it to be the default that has the empty track with a little of

13
00:01:06,360 --> 00:01:08,160
a light gray color.

14
00:01:08,350 --> 00:01:11,850
And I'm going to set the progress to be zero at the very beginning.

15
00:01:11,850 --> 00:01:13,310
So there is no progress.

16
00:01:13,600 --> 00:01:22,910
I'm going to go to my assistant Even though say this that is the wrong outlet.

17
00:01:23,000 --> 00:01:29,190
It's actually interesting that this happened because a lot of times for writing and dropping out that's

18
00:01:29,200 --> 00:01:31,300
you you end up with this error.

19
00:01:31,410 --> 00:01:34,230
I'm kind driving my actually view.

20
00:01:34,340 --> 00:01:37,520
And if this happens you're connecting the wrong object.

21
00:01:37,570 --> 00:01:44,210
So I let go of this one I'm going to go here to the actual outlet of the view or the scene.

22
00:01:44,210 --> 00:01:54,470
And when I say control drag this one is my progress view and it says The type is you I progress.

23
00:01:54,480 --> 00:01:58,320
So I know I'm connecting the right thing and that's about that.

24
00:01:58,310 --> 00:02:05,180
So I have it there now I'm going to go to my programming and say that's really all those things.

25
00:02:05,180 --> 00:02:15,890
Nice and tidy say I have a timer scheduled timer with targets and let me reformat everything.

26
00:02:17,930 --> 00:02:21,480
And so it does repeat from the bottom.

27
00:02:21,560 --> 00:02:23,490
No was there in full.

28
00:02:23,690 --> 00:02:29,850
It has a selector let's say called some progress.

29
00:02:30,020 --> 00:02:36,680
That's the function we have to write to get itself and the time intervals are every hundredths of a

30
00:02:36,680 --> 00:02:42,830
second Sananda write the function call function some progress.

31
00:02:42,830 --> 00:02:44,570
And here we have to do something.

32
00:02:44,570 --> 00:02:52,030
And if you remember because I'm using it with a selector I have to have on at objective c exposure.

33
00:02:52,190 --> 00:02:54,090
Otherwise it would give me an.

34
00:02:54,410 --> 00:02:58,970
Maybe maybe a drop that for a second so we can see the error that you see in here.

35
00:03:00,440 --> 00:03:06,170
So now the error says yes you have to have an objective c exposure.

36
00:03:06,230 --> 00:03:10,110
So I'm going at that now what do you want to happen in the progress.

37
00:03:10,110 --> 00:03:11,600
Well I'm going to see my progress.

38
00:03:11,600 --> 00:03:21,760
You do not progress which is a float plus Ikhwan 500 of face value.

39
00:03:21,770 --> 00:03:28,860
So we go there every hundredth of a second and be at the hundredth of a of 1 to the progress value.

40
00:03:29,060 --> 00:03:33,950
So let's go ahead and run this if I put up my simulator of

41
00:03:37,060 --> 00:03:38,440
me you should see

42
00:03:41,300 --> 00:03:42,890
this.

43
00:03:43,240 --> 00:03:47,360
Let's see once again it happened really quickly I didn't notice what happened.

44
00:03:49,740 --> 00:03:50,120
Yes.

45
00:03:50,130 --> 00:03:51,010
Perfect.

46
00:03:51,020 --> 00:03:55,760
Now I know that ought to be able to see the progress a little bit more visibly and then go ahead in

47
00:03:55,760 --> 00:03:59,610
here and saying go there every second.

48
00:04:00,160 --> 00:04:04,880
But I've only a hundred of us I can so I'm going to maintain that one.

49
00:04:04,890 --> 00:04:08,710
So now it's going to take 100 cycles to finish.

50
00:04:08,710 --> 00:04:14,680
Let's go ahead as you can see it's starting to build really really slowly.

51
00:04:14,690 --> 00:04:20,340
You know every every second is I think only a hundred of us I can tweet so.

52
00:04:21,260 --> 00:04:24,440
And that's about that's that's how you make your progress.

53
00:04:24,500 --> 00:04:30,560
Obviously the amount of the progress comes from somebody else and it is a little bit of a challenge

54
00:04:30,560 --> 00:04:38,150
here that I don't know if you noticed that but what happens when we reach the end of the progress.

55
00:04:38,150 --> 00:04:47,190
So if I set this back to a hundred and I run the application as you can imagine a mother of one sack

56
00:04:47,200 --> 00:04:50,590
and we will see the entire progress happening.

57
00:04:51,730 --> 00:04:52,540
I was done.

58
00:04:52,700 --> 00:05:01,700
So what is happening right now with our time at if is still going there into are some progress function

59
00:05:02,000 --> 00:05:07,130
and is trying to push the progress to numbers beyond our one.

60
00:05:07,250 --> 00:05:12,860
But she's definitely not a good teacher so we have to have a system for essentially saying well if you

61
00:05:12,860 --> 00:05:21,770
reach this number stop it don't go any further to do that and then go ahead and say I have a variable

62
00:05:21,980 --> 00:05:29,050
let's call it my timer which is a timer and my time is this time.

63
00:05:29,430 --> 00:05:31,850
So I'm going to reformat everything once again.

64
00:05:32,120 --> 00:05:33,590
Perfect.

65
00:05:33,670 --> 00:05:43,130
And then in the functions some progress and then I say if my progress view of progress is still below

66
00:05:43,130 --> 00:05:55,870
1 obviously do this thing you have to keep increasing the value else I'm going to save my time Darth

67
00:05:56,000 --> 00:05:57,570
invalidate.

68
00:05:57,590 --> 00:06:05,360
So if you reach the hundredth percent of it if you reached Avorn go ahead and invalidate timer's don't

69
00:06:05,360 --> 00:06:07,080
repeat it any more.

70
00:06:07,400 --> 00:06:15,290
Which is obviously a very important exercise making sure that you don't have unnecessary tasks running

71
00:06:15,290 --> 00:06:20,790
around your application that you that you essentially kill anyone that is not needed anymore.

72
00:06:21,080 --> 00:06:25,830
So if you run the application in terms of what we see nothing is going to change.

73
00:06:25,970 --> 00:06:32,770
But we know that now we don't have an unnecessary timer once we once we reach them.

74
00:06:33,230 --> 00:06:34,410
So that's about that.

75
00:06:34,460 --> 00:06:36,370
That's how you make your progress for you.

76
00:06:36,530 --> 00:06:38,150
And let's move on to our next lesson.
