Swift - How to create UITableView programmatically, insert and delete rows with animation

Lets Build That App · 70K views · 2016 · 25:51

Open on YouTube

Software (other)UX & UI designtutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about creating or configuring table views and cells programmatically without storyboards.

Recommended by 2 people across 2 different months, 2017 to 2018.

What it is

A 26-minute Swift tutorial from the Lets Build That App channel on building a UITableView entirely in code, using UITableViewController as the root view controller. It covers registering cell and header classes, implementing the datasource and delegate methods, and animating row insertion and deletion with insertRowsAtIndexPaths and deleteRowsAtIndexPaths.

What people said

Recommends mfaani · 2017-08 · Stack Overflow · on “How to add constraints in Basic Style TableView cell”

**Kindly** ,you should show us what you tried and how it failed. I recommend you see this [this video] video and also see this [LINK] . You can also search more for "how to create a tableViewcell programatically

Recommends kcg94 · 2018-03 · Stack Overflow · on “UITableViewCell not showing UILabel”

I did not check where you added your custom class to table view you should register your custom class to uitableview. You should check this video( [this video] ) in order to understand the concept of how to code programmatically.

Cites Srishti Mittal · 2018-08 · Stack Overflow · on “Swift unrecognised selector sent to instance”

I am following this video tutorial [this video] see at 14:00 and got this crash Terminating app due to uncaught exception 'NSInvalidArgumentException' unrecognized selector sent to instance. This is the code func setUpViews(){ addSubview(titleLabel) addSubview(createButton) createButton.addTarget(self, action: "createNotice", for: .touchUpInside) addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-16-[v0]-4-[v1]-4-|", options: NSLayoutFormatOptions(), metrics: nil, views: ["v0": titleLabel, "v1": createButton])) addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-4-[v0]-4-|", options: NSLayoutFormatOptions(), metrics: nil, views: ["v0": titleLabel])) addConstrain