I'm trying to have a UIView.transitionFromView animation between two UIImageViews, but i just cant get it right.
I checked this thread and did exactly as it told (as you can see in my code). I also checked some other threads and discussions on the web, but one of the two things happen -
when i do what the person in the link i provided does, the animation happens on the entire UIView of the VC, and not just for both the views i want to flip between.
when i put them both inside a container UIView, i get no 'flipping' animation - when the duration expires the things swap and that's it.
The relevant code - this is the version without the container, the one that 'flips' the entire superview of both of them (but only the relevant views 'change', the rest of the view just participates in the animation...)
var opponentCardView = self.opponentCards[self.opponentCards.count - 1]
var animalBackView =
UIImageView(image: UIImage(named: self.opponentAnimal.rawValue))
var cardCenter = opponentCardView.center
var cardWidth = opponentCardView.frame.width
var cardHeight = opponentCardView.frame.height
animalBackView.frame = CGRectMake(cardCenter.x - cardWidth / 2,
cardCenter.y - cardHeight / 2, cardWidth, cardHeight)
self.gameView.addSubview(animalBackView)
UIView.transitionFromView(opponentCardView, toView: animalBackView, duration: 1.0,
options: UIViewAnimationOptions.TransitionFlipFromLeft, completion: nil)
please help me solve this, have no idea what is happening. Thanks alot!
Aucun commentaire:
Enregistrer un commentaire