I have code that animate a view (change constraints)
UIView .animate(withDuration: TimeInterval(duration), delay: 0.0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: .curveEaseInOut, animations: {
self.topConstraint!.constant = self.yPositioOfOpenPanel
self.superview?.layoutIfNeeded()
}
The strange behaviour is that on iPhone X layoutSubviews
is called but on other simulators and real devices is not. (And I think it should be)
Same behaviour is when I change constraint manually
if let constraint = topConstraint {
constraint.constant = self.superview!.frame.height - recogniser.location(in: self.superview).y + yPositionOfBeginTouchInPanel
}
EDIT:
As suggested I am adding some new information.
Animations works very well, everything is animating as it should.
The problem is that I would like to trigger some new events, while animation is in place. (I would use topConstraint.constant to calculate something while animations is in place, or when I change topConstraint manually) That's why I would like to set some trigger on method layoutSubviews
. This method should be triggered when animations changes subviews.
I think that this works prior iOS 11 (but I can't be 100% sure, because this functionality is new in my program, but as I can remember I use this in other programs and it worked). It is still working for iPhone X (Simulator) but not for other simulators or real devices (obviously the real iPhone X is not out yet).