Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Expand and collapse UITableViewCells with UIStackView

This project demonstrates expanding and collapsing UITableView cells. There are many approaches to this but using a UIStackView is currently (Xcode 10, Swift 5) the one that best handles cells with unique heights and supports auto layout. There are so many details to get right that I collected them in this simple project, rather than searching Stack Overflow each time I implement. Details like pinning the UIStackView to the cell’s contentView , setting tableView.rowHeight = UITableView.automaticDimension, setting variable line height UILabels Content Compression Resistance Priority, etc. are easy to overlook and may not manifest issues till runtime.

expandingCellsAnimation

About

A simple example of using UIStackView to expand and collapse variable sized UITableViewCells with auto layout.

Resources

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages