şöyle bir şey iş görür sanırım,
override func viewDidLoad() {
super.viewDidLoad()
let imageArray:[UIImage] = [UIImage(named: "Image1")!,UIImage(named: "Image2")!,UIImage(named: "Image3")!,UIImage(named: "Image4")!,UIImage(named: "Image5")!]
let imageViewBounds:CGRect = CGRectMake(0.0, (self.view.frame.size.height - self.view.frame.size.width) / 2, self.view.frame.size.width, self.view.frame.size.width)
var imageView:UIImageView = UIImageView(frame: imageViewBounds)
imageView.backgroundColor = UIColor.redColor()
imageView.image = imageArray[0]
self.view.addSubview(imageView)
crossDissolveImageTransitionAnimation(imageView, images:imageArray, imageIndex:1, fullShowDuration: 2.0, fullHideDuration:0.5, crossDissolveDuration: 2.0)
}
func crossDissolveImageTransitionAnimation(imageView:UIImageView, images:[UIImage], var imageIndex:Int, fullShowDuration:NSTimeInterval, fullHideDuration:NSTimeInterval, crossDissolveDuration:NSTimeInterval) {
UIView.animateWithDuration(crossDissolveDuration / 2, delay: fullShowDuration, options: UIViewAnimationOptions.CurveEaseOut, animations: { () -> Void in
imageView.alpha = 0
}) { (Bool) -> Void in
imageView.image = images[imageIndex]
UIView.animateWithDuration(crossDissolveDuration / 2, delay: fullHideDuration, options: UIViewAnimationOptions.CurveEaseIn, animations: { () -> Void in
imageView.alpha = 1
}) { (Bool) -> Void in
if imageIndex < images.count - 1 {
++imageIndex
} else {
imageIndex = 0
}
self.crossDissolveImageTransitionAnimation(imageView, images:images, imageIndex:imageIndex, fullShowDuration:fullShowDuration, fullHideDuration:fullHideDuration, crossDissolveDuration: crossDissolveDuration)
}
}
}