Expanding Table View Cells! (Swift 4 in Xcode)

Jared Davidson · 122K views · 2018 · 13:01

Open on YouTube

Software (other)Web developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when asking or answering how to make expandable, collapsible table view sections or cells in iOS.

Recommended by 3 people across 3 different months, 2018 to 2020.

What it is

A 13-minute iOS tutorial by Jared Davidson (archetapp) showing how to build expanding and collapsing UITableView cells in Swift 4 using Xcode. It walks through a simple data model with an opened flag and reloads sections to reveal the extra rows.

What people said

Recommends Shubham Bakshi · 2018-10 · Stack Overflow · on “Expanding tableview sections on clicking each section”

This kind of feature requires a bit more code and I cannot write the whole code here but I can explain you the concepts that will be used to achieve this and will attach a few good tutorials which I used to ultimately create a feature like this First you need to create a custom HeaderView for your sections Next you need a UITapGestureRecognizer on your section and need to write your login inside the function provided in action part of UITapGestureRecognizer 's constructor You need to create a separate Protocol inside your HeaderView file and your ViewController that contains your TableView will adopt to that protocol and will handle whether to expand or collapse your rows Also, you will need

Recommends Ricardo Milos · 2019-01 · Stack Overflow · on “Expanding List UITableView is duplicating”

I want to create a dynamic table that expands another data when it selected. I've follow this tutorial [this video] but i cant make dynamic (each data is duplicating) Here's what i want to make [LINK] And here's what i've been made The data itself is duplicating and i dont know how to fix it because when i change some code inside tableView(), it'll crash when i select it or when i'm segue into this view. Here's my code: import UIKit import PopupDialog struct cellData { var isOpened = Bool() var title = [String]() var sectionData = [String]() } class TutorialBankTableViewController: UITableViewController { var user = DBManager.instance.getUserProfile() var tableViewData = [cellData]() var extended

Recommends karthik · 2019-02 · Stack Overflow · on “How to customize a section of cell”

the best solution is, if you have main and subCell, then you can achieve this effect by having one cell, on tap adjusting the height of the cell to show the subCell. working with header and footer is unnecessary in your case. just have cell, adjust a height of the cell on tap with animation. [this video]

Cites Lukas Smilek · 2018-11 · Stack Overflow · on “ios - Animated expanding TableView (tap on first row) inside TableView”

I’m building something like a todo app where I have EXPANDABLE “slave” UITableView inside “master” UITableViewCell (reason is “material design of expandable “slave” table). Maybe is also relevant that this is all inside a container UIView inside UIScrollView embed in NavigationViewController and TabViewController . Pretty complex... Let me explain: “Master” UITableViewControler with 2 section (this year/long term) with custom headers and custom TableViewCell Custom TableViewCell has a UIView and “slave” UITableView inside - underlying UIView is constrained to “slave” UITableView and makes it’s “material” design with shadow ( cropToBounds prevents shadow on UITableView ) “Slave” UITableView s

Cites Namely · 2019-01 · Stack Overflow · on “UITablewView Collapse Animation Speed”

Following sections move up too fast and overlaps collapsing section. Followed this tutorial [this video] func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if indexPath.row == 0{ if tableViewData[indexPath.section].opened == true { tableViewData[indexPath.section].opened = false let sections = IndexSet.init(integer: indexPath.section) tableView.reloadSections(sections, with: .none) }else{ tableViewData[indexPath.section].opened = true let sections = IndexSet.init(integer: indexPath.section) tableView.reloadSections(sections, with: .none) } } }

Cites BVB09 · 2020-01 · Stack Overflow · on “How do I build a custom object that consists of 2 custom objects for an expanding cell?”

I am following along this tutorial here [this video] for collapsing UITableViewCells and the mechanics are quite straight forward but I am not quite sure how to populate my model arrays from Firestore. He has manually created the data for demo purposes so naturally as a beginner, I am stumbling since instead of that I am making a network call to Firebase. My data structure is simple. The base collection (which would populate the title of the cell) extracts data from here: db.collection("Insurance_Plans") and contains the following strings: - Holder name - Holder contact etc. And each insurance holder has multiple properties insured and this is the sub-collection i.e. db.collection("Insurance_Plan

Cites BVB09 · 2020-03 · Stack Overflow · on “How do I loop through a firestore document that has an array of maps?”

The number of sections will be the total number of complaints at the start i.e. messageArray.count. When the user taps on the complaint section then the corresponding rows of planDetails will open up underneath. I found this video to indicate what I am trying to achieve: [this video] So each section (at the top) will be a complaint and the rows underneath it should be details with the menuItems, menuItemPrice and menuItemQuantity.