UIView animation downscale instantly hides the view

64 views Asked by At

I'm trying to downscale a view like this :

func test() {
    UIView.animate(withDuration: 2) {
        self.testView.transform = CGAffineTransform(scaleX: 1, y: 0)
    }
}

When I do this the view gets hidden instantly.

However if I set the Y scale to something close to 0 it works :

func test() {
    UIView.animate(withDuration: 2) {
        self.testView.transform = CGAffineTransform(scaleX: 1, y: 0.00001)
    }
}

Any idea why I have this behavior ? Is there a cleaner way to achieve this ?

Edit: Found an article about it here

0

There are 0 answers