I have a UITableView
custom cell. It has a UIView
and a UIButton
I want to change this view height constraint and the button's top constraint programmatically in my `cellForRowAtIndex. So Inside this im doing like this.
if(myintime2 == "00:00" && myoutTime2 == "00:00" )
{
cell.btnIntime2.setTitle(myintime2, for: .normal)
cell.btnOutTime2.setTitle(myoutTime2, for: .normal)
cell.btnOutTime2.isHidden=true
cell.btnIntime2.isHidden=true
cell.customViewHeightConstraint.constant = 111
cell.customBtnIn1Top.constant = 111/2
}
else if (myintime2 == "N/A" && myoutTime2 == "N/A")
{
cell.btnIntime2.setTitle(myintime2, for: .normal)
cell.btnOutTime2.setTitle(myoutTime2, for: .normal)
cell.btnOutTime2.isHidden=true
cell.btnIntime2.isHidden=true
cell.customViewHeightConstraint.constant = 111
cell.customBtnIn1Top.constant = 111/2
}
else
{
cell.btnIntime2.setTitle(myintime2, for: .normal)
cell.btnOutTime2.setTitle(myoutTime2, for: .normal)
cell.customViewHeightConstraint.constant = 222
cell.customBtnIn1Top.constant = 10
cell.btnOutTime2.isHidden=false
cell.btnIntime2.isHidden=false
}
But some cells the height is wrong, please help me