Created
January 3, 2020 04:51
-
-
Save indyfromoz/8c0ccfce3c44f606b5842adf42ce4a6d to your computer and use it in GitHub Desktop.
Self-sizing UITableView cell - Force update of UI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Via @layoutSubviews in /dev/world2019 | |
func tableView( _ tableView : UITableView, didSelectRowAt indexPath: IndexPath ) { | |
let cell = tableView.cellForRowAt( indexPath) as! MyCell | |
// Make some changes that affect the layout. Doing this but nothing else will cause clipped content. | |
cell.label.fontSize = 100 | |
// We have to force the table view to recalculate the cell size and update the UI | |
tableView.beginUpdates() | |
tableView.endUpdates() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment