In my application I want to animate a view from bottom to up in override func viewDidLayoutSubviews()
. So far I have done this way to transit the view from bottom but in different device it is showing different UI. UIView transition is working but view is not fully transitioning from bottom expect iPhone XS. So far I have done these two ways :
First Step:
let currentFrame = self.animationVIew.frame
self.animationVIew.frame = CGRect(x: 0, y: self.view.frame.height, width: currentFrame.size.width, height: currentFrame.size.height)
UIView.animate(withDuration: 1.0) {
self.animationVIew.frame = currentFrame
self.loadViewIfNeeded()
}
Second Step:
UIView.transition(with: animationVIew,
duration: 0.5,
options: [.transitionFlipFromBottom],
animations: {
},
completion: nil)
But for both way I am facing same problem. No luck!!
It was my mistake I did not think in proper way to solve it.Anyway if anyone face similar kind of problem then may be this answer will help them. I have just changed the current autolayout
to fix this issue.This problem was happening because of constraint between animationView
and topView
. The distance constraint between these two view was fixed, That is why when animation was happening it was resizing the animationView
to adjust the constraints.So my solution was making the animation view height constraint fixed and have changed the priority required
to low
of distance constraint between animationView
and topView
in storyboard