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

时间:2016-04-26 09:15:00

标签: swift nstimer

我遇到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

我无法理解为什么这不起作用。

0 个答案:

没有答案