2016-05-12 5 views
0

私はSwiftのアニメーションの完了ブロックでセグを実行しようとしています。しかし、セグには時間がかかり(約10秒)かかりますが、私にはなぜその理由がわかりません。ここでは、コードです:アニメーションの後にセグを実行する時間がかかります

override func viewDidAppear(animated: Bool) { 
     super.viewDidAppear(animated) 

     imageViewAnimated.startAnimating() 


     if label.center != CGPoint(x:50, y:10) { 

      UIView.animateWithDuration(2.0, delay: 0.0, usingSpringWithDamping: 0.0, initialSpringVelocity: 0.0, options: .CurveEaseOut, animations: {() -> Void in 
       self.label.center = self.view.center 

       }, completion: nil) 

      UIView.animateWithDuration(0.5, delay: 0.0, usingSpringWithDamping: 0.0, initialSpringVelocity: 0.0, options: .CurveEaseOut, animations: {() -> Void in 
       self.label.alpha = 0.0 

       }, completion: { finished in 

        self.poof.alpha = 1.0 
        self.performSegueWithIdentifier("backSegue", sender: nil) 
      }) 
     } 
    } 
+0

は、大量のデータをロードする新しいビューですか? – milesper

+0

新しいビューはテキストボックスとボタンだけですが、古いビューには多数の大きな画像がロードされています。 – Bailey

+0

なぜ表示されるとすぐにviewControllerから移行していますか? – milesper

答えて

0
override func viewDidAppear(animated: Bool) { 
      super.viewDidAppear(animated) 

      imageViewAnimated.startAnimating() 


      if label.center != CGPoint(x:50, y:10) { 

       UIView.animateWithDuration(2.0, delay: 0.0, usingSpringWithDamping: 0.0, initialSpringVelocity: 0.0, options: .CurveEaseOut, animations: {() -> Void in 
        self.label.center = self.view.center 

        }, completion: nil) 

       UIView.animateWithDuration(0.5, delay: 0.0, usingSpringWithDamping: 0.0, initialSpringVelocity: 0.0, options: .CurveEaseOut, animations: {() -> Void in 
        self.label.alpha = 0.0 

        }, completion: { finished in 

         self.poof.alpha = 1.0 
         dispatch_async(dispatch_get_main_queue(),{ 
          self.performSegueWithIdentifier("backSegue", sender: nil) 
         }) 
       }) 
      } 
     } 
関連する問題