1
00:00:00,910 --> 00:00:04,980
So will come again in this lesson we're going to talk about textfield.

2
00:00:05,050 --> 00:00:14,050
We use text fields for any situation where a user has to enter text entry values so that is username

3
00:00:14,050 --> 00:00:20,380
and password or it is the user's phone number or if it's a form on an application that user has to enter

4
00:00:20,380 --> 00:00:22,390
multiple different text.

5
00:00:22,570 --> 00:00:24,600
We rely on text as photos.

6
00:00:24,790 --> 00:00:30,310
So let's go ahead into ex-school and in the next quote I'm going to say or start a new project my new

7
00:00:30,310 --> 00:00:35,530
project is obviously a single view outgassing called Text fields.

8
00:00:36,310 --> 00:00:43,990
And then once it loads I'm going to go to my storyboard my storyboard I'm actually going to go ahead

9
00:00:44,020 --> 00:00:49,920
and say Give me a text field I'm going to place it some about here.

10
00:00:51,170 --> 00:00:57,230
Now if you pay attention you will see that textfield they don't let should change their height and that

11
00:00:57,230 --> 00:01:01,990
is because of their borders style by default that around borders sign.

12
00:01:02,060 --> 00:01:07,500
So I'm going to go to the editor and I'm going to change the border a style to be no border at all.

13
00:01:07,490 --> 00:01:13,430
And now it becomes like hey you I your are you I label that I can do pretty much whatever I want to

14
00:01:13,430 --> 00:01:14,060
do with it.

15
00:01:14,240 --> 00:01:15,590
So I'm going to change the signs.

16
00:01:15,620 --> 00:01:17,120
I'm going to say it's back.

17
00:01:17,170 --> 00:01:19,890
It's actually a light gray color.

18
00:01:19,890 --> 00:01:27,440
All right so now I was here light gray color and I'm actually going to add a placeholder for it say

19
00:01:27,980 --> 00:01:30,780
user name.

20
00:01:30,780 --> 00:01:31,140
All right.

21
00:01:31,160 --> 00:01:35,520
A place holder is essentially something that you see in textfield.

22
00:01:35,640 --> 00:01:37,880
Unless you start modifying it.

23
00:01:38,100 --> 00:01:41,940
And I'm going to send three line it to the center.

24
00:01:42,080 --> 00:01:45,800
Then let's go ahead and duplicate this on the duplicated one.

25
00:01:45,880 --> 00:01:53,650
I'm going to say this is actually e-mail and that's all that I I'm going to add one more.

26
00:01:53,690 --> 00:02:01,470
This one is going to be our let's say H and there's a reason I'm doing these three in particular.

27
00:02:01,550 --> 00:02:04,760
So let's change the keyboard for all of these.

28
00:02:04,760 --> 00:02:09,480
I'm going to say for a user name the key word should be the default keyboard.

29
00:02:09,890 --> 00:02:18,020
And then for e-mail the keyboard type should be an e-mail address keyboard and for H I one my keyboard

30
00:02:18,020 --> 00:02:23,220
to be a numeric keyboard which is this one a number of pop.

31
00:02:23,900 --> 00:02:29,420
So then let's say I am one to have a button that submits this information.

32
00:02:29,430 --> 00:02:37,430
So I'm going to add a button and that button is going to be here and this but then maybe I call it actually

33
00:02:37,730 --> 00:02:46,140
met some met with a bygone that's a little bit more clear for what it's going on in here.

34
00:02:46,250 --> 00:02:52,640
I will finally add a label that's going to show us the status of our submission for now is not really

35
00:02:52,640 --> 00:02:58,790
going to do anything it's just going to be there so we know that we did or we didn't submit so.

36
00:02:58,950 --> 00:03:00,200
And that's my art.

37
00:03:00,220 --> 00:03:03,890
Let's say resorte label and so it's as a result.

38
00:03:03,890 --> 00:03:05,240
QUESTION Mike for now.

39
00:03:05,570 --> 00:03:12,410
So great we have two text fields one submit button and one results are labeled.

40
00:03:12,440 --> 00:03:16,010
Let me just get myself a little bit better space like that.

41
00:03:16,010 --> 00:03:17,120
Fantastic.

42
00:03:17,130 --> 00:03:20,500
Now I need to do is I need to make the outlets for all of these.

43
00:03:20,510 --> 00:03:22,150
So that's going to be very easy.

44
00:03:22,150 --> 00:03:24,140
We've done it many many times before.

45
00:03:24,230 --> 00:03:31,340
I'm going to my assistant editor in the assistant head somewhere along the dot H I am at that age I'm

46
00:03:31,340 --> 00:03:36,460
going to say let's get a little bit better spacing in here.

47
00:03:36,900 --> 00:03:44,190
And this is going to be user name and takes for the next event.

48
00:03:44,350 --> 00:03:48,190
This is going to be email text field.

49
00:03:48,290 --> 00:03:52,820
This is obviously going to be a text field.

50
00:03:52,940 --> 00:03:57,070
This is going to be resolved label.

51
00:03:57,350 --> 00:04:02,600
And finally I have a soft Mitt action submits action.

52
00:04:02,750 --> 00:04:06,870
Remember that for the submit change the connection to an action.

53
00:04:07,220 --> 00:04:16,950
So now I have four outlets which are here in my age username textfield email textfield age text field

54
00:04:17,150 --> 00:04:18,370
on the label.

55
00:04:18,500 --> 00:04:20,860
And then I have this submit action.

56
00:04:20,870 --> 00:04:23,360
Now let's go ahead into our coding.

57
00:04:23,380 --> 00:04:27,860
You are in that am I'm going to clean everything up.

58
00:04:27,860 --> 00:04:30,490
Of course I have to have my view with it.

59
00:04:30,590 --> 00:04:35,360
I have my self made action which is the action that you have over there.

60
00:04:35,660 --> 00:04:37,600
So let's see what we want to do.

61
00:04:37,610 --> 00:04:43,850
So when I press the submit button I want to get the username I want I get there age.

62
00:04:43,910 --> 00:04:49,600
I also want to get their e-mail address and I want to submit all of them into one string and show it

63
00:04:49,610 --> 00:04:50,560
in the resort.

64
00:04:50,570 --> 00:04:52,760
So that's what we want to do is simple.

65
00:04:52,760 --> 00:05:03,110
I'm going to say and I Sistrunk name is going to be the user name or what they call they call it user

66
00:05:03,110 --> 00:05:04,470
name didn't I.

67
00:05:04,880 --> 00:05:17,450
Yes user name which is going to be user name textfield dot text and then enter a strange e-mail is going

68
00:05:17,450 --> 00:05:32,230
to be e-mailed textfield the dot text and then I have A.S. Thring H is going to be H textfield h textfield.

69
00:05:32,990 --> 00:05:38,080
They call it age text with what they call it age text filthiest text.

70
00:05:38,690 --> 00:05:43,860
And then I'm going to have one string that appends all of these together.

71
00:05:44,210 --> 00:05:46,070
That's going to be unnecessary.

72
00:05:46,160 --> 00:05:48,690
Let's call it the phrase string.

73
00:05:49,350 --> 00:06:00,140
And that's going to a and as a string string with formats bring ring format and the format is this name

74
00:06:00,200 --> 00:06:12,580
or let's say What if the values name via email and something.

75
00:06:13,220 --> 00:06:15,170
All I'm saying.

76
00:06:15,170 --> 00:06:17,030
Years old.

77
00:06:17,240 --> 00:06:18,650
So here's what's going to happen.

78
00:06:18,650 --> 00:06:23,620
I'm going to say the first volume is named the second one is e-mail and the last one is age.

79
00:06:23,630 --> 00:06:32,900
So what's going to do is going to say whatever name we read whatever e-mail these many years or so that's

80
00:06:32,900 --> 00:06:33,920
what we wanted to see.

81
00:06:33,920 --> 00:06:39,350
And we're going to put it in the Rose label dot text.

82
00:06:39,440 --> 00:06:42,260
It's going to be a string.

83
00:06:42,610 --> 00:06:48,580
Apparently they have misspelled that so let's call it this ring and that's about it.

84
00:06:48,620 --> 00:06:53,960
So let's run this application Now if all goes well which I'm hoping you will.

85
00:06:54,140 --> 00:07:00,200
We should be able to answer all of these values and also see them in our Laymon.

86
00:07:01,400 --> 00:07:02,980
So user name.

87
00:07:02,990 --> 00:07:11,630
I'm going to put my name on here and then and here is Zamperla dot com an age I'm going to say 100 at

88
00:07:11,650 --> 00:07:13,900
age years old submit.

89
00:07:13,950 --> 00:07:21,020
I mean really I mean examples come on 100 years or exactly what we expect in a few little you know housekeeping

90
00:07:21,020 --> 00:07:25,070
matters one of them is that we wanted to get rid of the keyboard.

91
00:07:25,310 --> 00:07:31,100
If you don't see the keyboard at all it's because your keyboard is not being shown and you can go to

92
00:07:31,100 --> 00:07:34,320
a keyboard and say toggle sauf keyboard.

93
00:07:34,430 --> 00:07:35,900
So that's command case.

94
00:07:35,900 --> 00:07:38,820
So if you had come on your keyboard will appear.

95
00:07:39,050 --> 00:07:42,410
But then when we had submit it doesn't disappear.

96
00:07:42,560 --> 00:07:47,560
So here's what we're going to do in this segment and I'm going to get myself a little better spacing

97
00:07:47,570 --> 00:07:49,490
in here in the submit.

98
00:07:49,520 --> 00:07:57,320
I'm going to say username text didn't resign the first responder.

99
00:07:57,710 --> 00:08:02,700
And then I'm going to say e-mail textfield resign the first responder.

100
00:08:02,870 --> 00:08:10,760
And of course H takes will resign first responders so get rid of all of the keyboards that use to get

101
00:08:10,760 --> 00:08:13,700
rid of the keyboards resigning the first responders.

102
00:08:13,700 --> 00:08:17,860
So that's one thing I need to fix.

103
00:08:17,950 --> 00:08:28,860
So now whatever I enter in here and then year and 200 submit keyboard disappears you see when I go here

104
00:08:28,860 --> 00:08:31,950
the cable shows up and I had made it disappear.

105
00:08:31,960 --> 00:08:37,950
And also I don't know if you know is but depending on the text will we go to our keyboard is changing.

106
00:08:37,950 --> 00:08:39,720
This is the default keyboard.

107
00:08:39,780 --> 00:08:41,390
This is the keyboard for e-mail.

108
00:08:41,400 --> 00:08:48,350
It has the odd sign on this obviously the numeric keyboard that allows us to enter numeric values.

109
00:08:48,390 --> 00:08:51,570
Another thing you probably want to do is you want to clean all of these.

110
00:08:51,570 --> 00:08:56,490
So once you submit you want to make all of them empty that would be very simple.

111
00:08:56,490 --> 00:09:00,830
That would be user name takes real dot text becomes empty.

112
00:09:01,170 --> 00:09:02,940
And then when I copy this.

113
00:09:03,150 --> 00:09:09,100
And the next time it's going to be email textfield and the last thing is going to be age textfield.

114
00:09:09,120 --> 00:09:14,690
So let me get a little with a spacing in here so we can see everything in our function so far.

115
00:09:14,880 --> 00:09:17,440
And let's read on it now.

116
00:09:21,210 --> 00:09:29,370
It i have my name I have my email and I have my own age and I have to submit.

117
00:09:29,380 --> 00:09:30,650
The keyboard disappears.

118
00:09:30,670 --> 00:09:34,060
They all go on here for some reason.

119
00:09:34,060 --> 00:09:36,260
And here's a big mistake that I made.

120
00:09:36,310 --> 00:09:38,440
Everything has become empty.

121
00:09:38,440 --> 00:09:39,280
Why is that.

122
00:09:39,280 --> 00:09:45,840
Because I forgot to first do everything I want to do and then empty my text fields.

123
00:09:46,000 --> 00:09:52,230
I emptied my text with a little bit in a rush thought let's cut this off point at the very end.

124
00:09:52,420 --> 00:09:57,870
So once you have known everything that you want to do then empty the text field.

125
00:09:57,880 --> 00:10:00,150
So this time everything should work.

126
00:10:02,990 --> 00:10:15,300
In here I have once again my name my e-mail and a 100 A submit they appear here and everything clears

127
00:10:15,310 --> 00:10:15,960
up.

128
00:10:16,340 --> 00:10:24,230
Now a few really quick notes that if you need that you can obviously change the keyboard size in almost

129
00:10:24,260 --> 00:10:27,630
every word you can do it in the text keyboard.

130
00:10:27,650 --> 00:10:30,060
They come up more frequently than the others.

131
00:10:30,200 --> 00:10:35,360
So for instance like with say e-mail text failed thought the keyboard to type.

132
00:10:35,360 --> 00:10:43,190
And it says you have to give me a new keyboard type so I'm going to say you my keyboard to type and

133
00:10:43,190 --> 00:10:45,170
then I forget it is the one that I want.

134
00:10:45,170 --> 00:10:47,320
Actually it's an e-mail so I don't want that.

135
00:10:47,330 --> 00:10:54,650
I want an e-mail one so that's an easy thing you can change it either in the interface builder or here

136
00:10:54,650 --> 00:10:55,940
in the code.

137
00:10:55,940 --> 00:11:01,280
The other thing that I should mention to you guys is that there are values that we are receiving here

138
00:11:01,280 --> 00:11:09,860
are all Ennis's strings so the value you getting for the age is not a numeric value it's an actual Ah

139
00:11:09,920 --> 00:11:11,510
what you call a text value.

140
00:11:11,510 --> 00:11:16,100
So for instance if I go in here and I write 100 This isn't 100.

141
00:11:16,100 --> 00:11:26,000
This is 1 0 0 that the reads are 1 0 0 4 in US history not a numeric number which is after 99 and before

142
00:11:26,000 --> 00:11:26,570
1 0.

143
00:11:26,570 --> 00:11:27,930
One hundred and one.

144
00:11:27,950 --> 00:11:32,090
So if you want you can actually try to get the integer values.

145
00:11:32,090 --> 00:11:42,560
So for instance I could go in here and say it's age and it is going to be age text textfield dot text

146
00:11:43,120 --> 00:11:44,920
interline you.

147
00:11:45,050 --> 00:11:47,780
This isn't specific to our text.

148
00:11:47,840 --> 00:11:54,490
This is specific to strings so we can say extract the integer value out of here.

149
00:11:54,530 --> 00:11:56,980
So it's going to go in there and it's going to look for the value.

150
00:11:57,000 --> 00:12:01,910
And if you have something like this is going out and only find the first three letters it's going to

151
00:12:01,910 --> 00:12:05,480
say 100 is the number I can make out of here.

152
00:12:05,610 --> 00:12:11,600
And that survey that you could use it for this in the future in about in the next section essentially

153
00:12:11,930 --> 00:12:19,310
when we learn about the delegation we will then raise about forcing these takes readers to accept certain

154
00:12:19,310 --> 00:12:20,740
type of characters.

155
00:12:20,750 --> 00:12:27,920
Right now the keyboard for age is numeric but you could actually enter other values you know on an actual

156
00:12:27,920 --> 00:12:32,660
device you can change the keyword and you could actually enter other values just like whoa.

157
00:12:32,660 --> 00:12:37,610
Now I'm actually entering you know string values or characters.

158
00:12:37,670 --> 00:12:45,320
Once you learn about you I textfield delegation will learn about ways to force this to only accept numbers.

159
00:12:45,320 --> 00:12:52,430
So when you had I don't know 25 a a would automatically delete and as many times as you try it doesn't

160
00:12:52,430 --> 00:12:57,980
let you fill in any non numeric values but because say this down that's right.

161
00:12:58,400 --> 00:13:00,840
And with that I think we're a good fit.

162
00:13:00,860 --> 00:13:04,880
The text feels for entering text into the values.

163
00:13:04,880 --> 00:13:06,600
I will see you in the next lesson.
