I am using UIView.animateWithDuration to slide in a view upon tap recognition. This is working fine except, for the very first time, the view is unhidden slightly late and it suddenly appears mid-way through the animation. Subsequent show/hide operations do not have this issue.
I am implementing this as follows
textBlurBackground.hidden = false
descriptionOutlet.hidden = false
UIView.animateWithDuration(0.4, delay: 0.0, options: nil, animations: {
self.textBlurBackground.transform = CGAffineTransformMakeTranslation(0, 0)
self.descriptionOutlet.transform = CGAffineTransformMakeTranslation(0, 0)
}, completion: nil)
so it seems like, even though I'm setting the "hidden" property first (on the first two lines) this is somehow delayed and only executed while the animation is already running. Note that this only happens the first time when the view is created; subsequent show/hide operations work fine (the views are completely unhidden prior to the animation).
I notice there is a "completion" hook - is there something equivalent for a preparation phase? I.e. don't start the animation until view is fully unhidden.