Here is my screen. Consider the first row till Repeat switch :
Following is the switch action :
/**
Function name : repeatAction
Repeat UISwitch action
**/
@IBAction func repeatAction(sender: UISwitch)
{
if sender.isOn
{
cellDateTime.constrain_viewRepeatHeight.constant = 80
UIView.transition(with: self.cellDateTime.view_repeat, duration: 0.6, options: .transitionCrossDissolve, animations: {() -> Void in
self.cellDateTime.view_repeat.isHidden = false
}, completion: { _ in })
}
else
{
UIView.transition(with: self.cellDateTime.view_repeat, duration: 0.6, options: .transitionCrossDissolve, animations: {() -> Void in
self.cellDateTime.view_repeat.isHidden = true
}, completion: { _ in
self.cellDateTime.constrain_viewRepeatHeight.constant = 0
})
}
let offset = self.table_InitialData.contentOffset
self.table_InitialData.layer.removeAllAnimations()
self.table_InitialData.beginUpdates()
self.table_InitialData.endUpdates()
self.table_InitialData.contentOffset = offset
}
When switch is in on state for the first time, it works fine :
Now when the switch is in off state again, ideally it should appear as in the first screenshot. However, it looks like this :
I am using auto layouts. Just to mention, previously I had the same controls in a simple controller view and that worked fine. But since I placed them in UITableView, it is getting weird.