The Mother of Joseph Beuys The Mother of Joseph Beuys - 2 months ago 7x
iOS Question

How does one programmatically change a constraint on a UITableViewCell?

When creating a cell in:

func tableView ( tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath ) -> UITableViewCell

It turns out
equals 0, even though the xib containing the cell layout is packed with them. Implementing the following two functions - which I imagined might be called at opportune moments - produces a similarly disappointing result:

func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath)

If I can't access the constrains, how can I ever change them?

What am I doing wrong here, please? Thank you.


make the IBOutlet for you constraint in your UITableViewCell class then do the changes in cellforrowatindexpath method.

ex: in cellforrowatindexpath

cell.texlabel.topspace.constant = 100;