How do I make a UIView
slide up with a touch of a button from its original position and them bring it back down with a touch of a button? Using Swift and Xcode 6.>
You have to implement an animation changing the DynView
position on click. Here's an example:
@IBAction func btnUp(sender: AnyObject) {
let xPosition = DynView.frame.origin.x
let yPosition = DynView.frame.origin.y - 20 // Slide Up - 20px
let width = DynView.frame.size.width
let height = DynView.frame.size.height
UIView.animateWithDuration(1.0, animations: {
dynView.frame = CGRect(x: xPosition, y: yPosition, width: width, height: height)
})
}