2017-03-10 106 views

回答

-1

我知道了!你必須把約束和操作...

如果動畫{ ivImageLoadingInside.frame =的CGRect(X:0 - 160,Y:123,寬度:160,高度:12)

 UIView.animate(withDuration: 1.2, delay: 0, options: .repeat, animations: { 
      self.ivImageLoadingInside.frame = CGRect(x: ScreenSize.SCREEN_WIDTH, y: 123, width: 160, height: 12) 

     }, completion: nil) 
    } else { 
     ivImageLoadingInside.layer.removeAllAnimations() 
    }* 

看看這個鏈接http://mathewsanders.com/prototyping-iOS-iPhone-iPad-animations-in-swift/

0
self.ivImageLoadingInside.center = CGPoint(x: 80 - self.ivImageLoadingInside.bounds.width/2, y: 0) 
+0

感謝您的幫助,男人! –

2
private func animation(viewAnimation: UIView) { 
    UIView.animate(withDuration: 2, animations: { 
     viewAnimation.frame.origin.x = +viewAnimation.frame.width 
    }) { (_) in 
     UIView.animate(withDuration: 2, delay: 1, options: [.curveEaseIn], animations: { 
      viewAnimation.frame.origin.x -= viewAnimation.frame.width 
     }) 

    } 
} 
相關問題