iOS Dev Course: UITableView
How to make infinity feed using just one element and reuse it again and again?
Let’s make a simple project with UITableView in quick guide!
Overview
A table view displays a list of items in a single column. UITableView
is a subclass of UIScrollView
, which allows users to scroll through the table, although UITableView
allows vertical scrolling only. The cells comprising the individual items of the table are UITableViewCell
objects; UITableView
uses these objects to draw the visible rows of the table. Cells have content—titles and images—and can have, near the right edge, accessory views. Standard accessory views are disclosure indicators or detail disclosure buttons; the former leads to the next level in a data hierarchy and the latter leads to a detailed view of a selected item. Accessory views can also be framework controls, such as switches and sliders, or can be custom views. Table views can enter an editing mode where users can insert, delete, and reorder rows of the table.
Read more on Apple Developer
Preparation
Create a new Single View App project.
Hotkey: shift + command + N
Open Main.storyboard
How to add a UITableView to storyboard?
Just press: shift + command + L
Choose Table View and drag it to storyboard.
Cool. Your first Table View is on scene.
Let’s setup constraints to make Table Size as superview.
Let’s add reference to that table into your module.
- Open Split mode
- Press ctrl on view and drag cursor to code
- Write reference name
- Press connect
Open ViewController.swift file.
Modify code in file.
Run project on simulator.
You’ve done it! Clap! Clap!
Remember, the receipt to success is continuous learning and communication with colleagues including, self-education.
This was a small guide about UITableView and Data Source. Read more on Apple Developer site. Don’t stop self-education.
Subscribe to my account to get notifications about new stories.
If you still have questions — write about it in the comments. I’ll answer them in future articles.