Swift 2.0 xCode 7.2在这种情况下如何运行动画=?

Swift 2.0 xCode 7.2在这种情况下如何运行动画=?,swift,nstimer,Swift,Nstimer,我对xCode有问题。我有一个为马创建动画的代码,但是动画不会启动 动画由NSTimer启动 /********************** background *************************/ var imBackGroundView: UIImageView! // override let imBackGroundView: Int func runMe0002() { if (self.imBackGroundView ==

我对xCode有问题。我有一个为马创建动画的代码,但是动画不会启动

动画由NSTimer启动

/**********************  background  *************************/    
var imBackGroundView: UIImageView!    
// override let imBackGroundView: Int

func runMe0002()  {      
  if (self.imBackGroundView == nil) {
    self.view.backgroundColor = UIColor(patternImage: UIImage(named:
    background[Int(arc4random_uniform(UInt32(background.count)))])!)
    //background = arrow  as String and  it works normally...            
  }  //bracket if
  else if (self.view.backgroundColor == "bk0001.jpg") 
    // it was tested as == 0 as index of arrow...
    // if else remove and keep only if - at end of block else snap into action...
   {        
     /*************** contlol animation (tested...) *****************/

     use = UIImageView(frame:CGRectMake(360, 200, 600,80))
     use.image = UIImage(named: "use0002.png")
     self.view.addSubview(use)

     UIView.animateWithDuration(1.0, animations: {
       self.use.frame = CGRect(x: -670, y: 200, width: 600, height: 80) }, completion: nil)

   }  // bracket else if  */
   else {
     print("don't want start...")  // not print...in other words = else if works... as seems...
  }
}  // bracket func runMe0002

我不明白为什么这不起作用。

检查此答案在动画的if-else循环中打印以查看其是否起作用检查此答案在动画的if-else循环中打印以查看其是否起作用