I have some images and an ImageView according to the photos
I would like to be able to toggle the imageView image, switching from one to another every 5 seconds automatically.
How could I do this?
You can use transitionWithView:
let toImage = UIImage(named:"myname.png")
UIView.transitionWithView(self.imageView,
duration:5,
options: UIViewAnimationOptions.TransitionCrossDissolve,
animations: { self.imageView.image = toImage },
completion: nil)
Example: link
You can also use these options: link
Just put the logic to change for each image.
NSTimer(timeInterval: 0.5, target: self, selector: "TrocarImagem", userInfo: nil, repeats: true)
func TrocarImagem() {
let imagem = UIImage(named:"imagem01.jpg")
}