-
Notifications
You must be signed in to change notification settings - Fork 61
Animating
Evgenii Neumerzhitckii edited this page Jun 10, 2015
·
10 revisions
One can customize both hide and show animation for the notification bar before it is shown. You can either use one of the animation presets or provide your own animation closure.
There are animation presets defined in DodoAnimations
enum.
// Use existing animations
view.dodo.style.bar.animationShow = DodoAnimations.Rotate.show
view.dodo.style.bar.animationHide = DodoAnimations.SlideRight.hide
// Turn off animation
view.dodo.style.bar.animationShow = DodoAnimations.NoAnimation.show
view.dodo.style.bar.animationHide = DodoAnimations.NoAnimation.hide
// Customize duration of the animation
view.dodo.style.bar.animationShowDuration = 0.5
view.dodo.style.bar.animationHideDuration = 1
You can use your own code for animating the bar view. If you do so, make sure you call the onCompleted
argument callback.
view.dodo.style.bar.animationShow = { view, duration, locationTop, onCompleted in
let actualDuration = duration ?? 0.5
view.alpha = 0
UIView.animateWithDuration(actualDuration,
animations: {
view.alpha = 1
},
completion: { finished in
onCompleted()
}
)
}