hi there.
I have a view that contains a Tableview.
I want to set the tablewiew heigt dynamically according to the number of cell to display.
wich parameter should i modify?
thaks for your help.
hi there.
I have a view that contains a Tableview.
I want to set the tablewiew heigt dynamically according to the number of cell to display.
wich parameter should i modify?
thaks for your help.
I do this with constraints.
I create
- in IB a constraint on the tableView height
- in the view controller, an IBOutlet for the constraint
@IBOutlet weak var tableViewHeightConstraint: NSLayoutConstraint!
- then, I adapt the constant as needed, when needed:
let fullHeight = numberOfCell * cellHeight
tableViewHeightConstraint.constant = CGFloat(fullHeight)
You could also change the frame
tebleView.frame.height = whateverValue