I have a question that should be fairly simple. Basically, I am trying to move an object (UIImageView) from point A (where it is installed in the storyboard) to point B, which I define programmatically.
My first pass through this led to this code
UIView.animateWithDuration(0.75, delay: 0.5, options: UIViewAnimationOptions.CurveLinear, animations: {
self.signInButton.alpha = 1
self.signInButton.center.y = 10
}, completion: nil)
However, what this code does is basically move the offcenter button and then back to its original location.
Then I looked in QuartzCore to help me, but everything in Objective-C. I have this method:
func moveImage(view: UIImageView){
var toPoint: CGPoint = CGPointMake(0.0, -10.0)
var fromPoint : CGPoint = CGPointZero
var movement = CABasicAnimation(keyPath: "movement")
movement.additive = true
movement.fromValue = fromPoint
movement.toValue = toPoint
movement.duration = 0.3
view.layer.addAnimation(movement, forKey: "move")
}
However, the problem here is that movement.fromValueit cannot accept CGPoint. I know that there was a function in the C object that converts a CGPointto NSValue, however this function does not seem to be recommended from Swift, and I cannot find another way to do this.
, CGPoint NSValue, moveImage() , A B?
!
UIImage UIImageView ( ) Loop