1

Here is my animation...one weird thing is when I type in a text field and hit done I proceed to set txtdata.text = ""..... and after that my image animation coordinates get all messed up.

    override func viewDidAppear(_ animated: Bool) {

    UIView.animate(withDuration: 15.0, delay: 0, options: [.repeat, .autoreverse], animations: {


        self.smallCloud.center = CGPoint(x: self.screenSize.maxX  , y:self.r.origin.y)

    }, completion: nil)      
}  ///////////////////////////////////////////////////////////////

open func textFieldShouldReturn(_ textField: UITextField) -> Bool {
            txtData.text = "";
    return false
}

so the image basically moves from one side to another...if i dont hit done on the keypad the image moves as expected, however as soon as I hit done and put the UITextField back to " "; the image gets out of wack and goes off the screen anyone have any idea whats going on here?

  • Alrighty, I was using Xcode to program my swift application and I decided to put auto-constraints on my UIImage that was being animated...then when I would switch a label auto constraints would go all out of wack..after looking at post about Animation and constraint problems I finally just resorted to updating the constraints and it worked.. however I took the easy way out, I am going to look into animations and auto constrains but if your looking for an answer check this link out http://stackoverflow.com/questions/12622424/how-do-i-animate-constraint-changes ,it may help! cheers – Nicholas Cameron Nov 25 '16 at 01:39

0 Answers0