我有這段代碼,使圖像移動,但我希望這在打開頁面5秒後顯示。顯示和移動圖像
我該怎麼做?由於
@IBOutlet weak var moveobj: UIImageView!
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
let orbit = CAKeyframeAnimation(keyPath: "position")
var affineTransform = CGAffineTransformMakeRotation(0.0)
affineTransform = CGAffineTransformRotate(affineTransform, CGFloat(M_PI))
let circlePath = UIBezierPath(arcCenter: CGPoint(x: 198 - (100/2),y: 135 - (100/2)), radius: CGFloat(155), startAngle: CGFloat(255), endAngle:CGFloat(M_PI * 2), clockwise: true)
orbit.path = circlePath.CGPath
orbit.duration = 18
orbit.additive = true
orbit.repeatCount = 0.15
orbit.calculationMode = kCAAnimationPaced
moveobj.layer .addAnimation(orbit, forKey: "orbit")
所以,你要5秒顯示圖像? –
不,我想顯示這個圖像5秒後,我打開一個頁面,並開始移動 – dinis
例如我打開一個頁面等待5秒,這開始移動 – dinis