"Intermediate Swift 2" was retired on May 31, 2020. You are now viewing the recommended replacement.
Well done!
You have completed Treehouse Quick Tips!
You have completed Treehouse Quick Tips!
Create a registration form within a storyboard for iPhone and iPad. This is done using a static table in Xcode. Static tables are used throughout the settings app.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up[treehouse presents] 0:00 [Quick Tips: Creating a Registration Form in iOS with Amit Bijlani] 0:02 Hi I'm Amit, and in this Treehouse Quick Tip 0:05 we're gonna learn how to create a Form using a Static Table 0:09 within a storyboard. 0:12 Static Tables are used throughout the settings app on an iPhone or iPad. 0:14 Let's learn how to create one. 0:20 Let's start with a single view project and make sure that the first View Controller 0:22 in the storyboard is a Table View Controller. 0:27 As you can see this is a regular View Controller; we will delete this 0:30 and add a Table View Controller. 0:35 We will also make sure that the ViewController.h inherits from 0:41 UiTableViewController. 0:46 Now going back to the main storyboard, the first thing we will make sure 0:51 is that our Table View Controller connects to our View Controller, 0:56 which is this ViewController.h. 1:02 So make sure that the Table View Controller is selected 1:05 here in the hierarchy viewer 1:08 and enter Class View Controller. 1:12 Now our Table View Controller is connected to the View Controller. 1:15 When you first select the Table View, so opening up our hierarchy view 1:20 you can select Table View. 1:25 You will notice that it is selected to have Dynamic Prototype as it's Content. 1:27 Going over to the attributes inspector and you will notice that the content says 1:33 Dynamic Prototypes. 1:39 We can change this to Static Cells because Dynamic Prototypes 1:40 is when you are providing it with data and dynamically creating rows 1:45 within this table to fit that data. 1:49 Let's find out how to quickly create a registration form 1:51 using the Static Table. 1:54 Now a Table is made up of Cells 1:56 and the grouping of the Cells is known as a Section. 1:59 We can also change the style of the table. 2:03 We can go from Plain to Grouped, 2:06 so as you can see the style changes over here. 2:09 We can also provide our Section with a Section Header. 2:12 If you click on Table View Section in the hierarchy view, 2:16 you can go ahead and change the Header. 2:21 I'll call this Header: Registration. 2:23 As you can see we now have a Header. 2:28 Each Cell can have several different styles, 2:32 as you can select from the style in the Attributes Inspector, 2:36 but let's keep it as Custom 2:39 and we will add a Label and a Text Field for our registration. 2:42 So searching for Label in the box down here, 2:50 we will take the Label and drag it to our Cell. 2:54 Next I'll search for Text Field and take the Text Field, 2:59 and once again drag it to our Custom Cell. 3:04 I can call this Label: Name 3:09 and similarly I can duplicate this Cell and have another field called Email. 3:14 Since these are Text Fields I can customize the Return Key, 3:29 which is under Return Key, and instead of Default I can select Next, 3:34 and for the Email one I can select Done. 3:39 Finally what you wanna do is, 3:44 now that you have these Custom Text Fields in your Custom Table View Cell, 3:46 you can add IBOutlets to your View Controller. 3:52 Basically going over to the assistant editor, let's make some room, 3:56 holding down the control key you can drag it to the interface and create IBOutlets. 4:03 If you run this application, you will see now you can enter information 4:24 and capture it programatically. 4:29 Using Static Table to create a Form is just one use case. 4:32 You can use it for a whole wide variety of scenarios. 4:37
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up