For one animation after another you can use NSTimer ...
See my code, this may help ...
class ViewController: UIViewController { @IBOutlet weak var IBimg1: UIImageView! @IBOutlet weak var IBimg2: UIImageView! @IBOutlet weak var IBimg3: UIImageView! override func viewDidLoad() { super.viewDidLoad() startAnimation1() } func startAnimation1(){ NSTimer.scheduledTimerWithTimeInterval(2.0, target: self, selector: Selector("startAnimation2"), userInfo: self, repeats: false) UIView.animateWithDuration(2.0, animations: { self.IBimg1.alpha = 0 }) } func startAnimation2(){ NSTimer.scheduledTimerWithTimeInterval(2.0, target: self, selector: Selector("startAnimation3"), userInfo: self, repeats: false) UIView.animateWithDuration(2.0, animations: { self.IBimg2.alpha = 0 }) } func startAnimation3(){ UIView.animateWithDuration(2.0, animations: { self.IBimg3.alpha = 0 }) } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning()
Explanation...
- Here the startAnimation1 () method calls viewDidLoad ()
- Then I call the NSTimer method for startAnimation2 () . Here, notice that the startAnimation2 () method is called after 2 seconds ..., i.e. After the first animation is finished ...
thanks
source share