Table views are the lists you see throughout iOS, such as in the Settings, Reminders, and Health apps. Learn what they are and how to get them into your applications.
- [Narrator] Table views are extremely common in iOS 11. For example in the settings app you have these different groups of options that are in a list format. These are known as a table view when you're developing. You can select these options to go down to the next menu and they have little arrows on the right side. Some of them have icons on them and they each have a little label. So what we're going to be looking at throughout this chapter is how you can implement table views in your application and customize them to your liking.
So I'm just going to return to Xcode and in here I'm in my main storyboard, which has nothing in it currently. This is just a single-view application template. And I'm going to drop a table view onto my screen. So in the object library I'm going to filter for table view and what you want is a table view, not a table view controller for now. That's something that creates a new view controller with a table view inside of it. So what we're doing here is creating a table view from scratch so you can see how every element of the table view works.
Then later on you can use this view controller if you need to to take a few shortcuts. So I'm going to click and drag this table view out and I'm dragging it to the top left corner and I'm going to drag the bottom right corner handle and just snap it to the bottom right. Once it's all in place, I'm going to press Shift + Option + Command + = that's going to add those auto layout pins and at this point you should be able to run the application and see the table view in the simulator.
So here's our empty table view in a simulator and you'll notice that there's no data inside of it. In other words you don't see any words anywhere you just see these blank lines and that's really just what we get when we create an empty table view. To fill those lines, or to make our list, we need to use a data source for the table view and we're going to look at doing that later on.