UIView rotate and cross-fade at the same time
UIView rotate and cross-fade at the same time
- Subject: UIView rotate and cross-fade at the same time
- From: "Eric E. Dolecki" <email@hidden>
- Date: Tue, 06 Oct 2015 13:04:00 +0000
I have a UIView with a UIImageView in it, a button on top of that. I want
to trigger a rotation with an image cross-fade* at the same time*. This
isn't working for me. Is there a better solution?
@IBAction func newMagicPressed(sender: UIButton) {
if bMagicButtonCloseMode {
let toImage = UIImage(named: "presetButtonIcon.png")
UIView.transitionWithView(self.magicButtonImage,
duration:0.5,
options: UIViewAnimationOptions.TransitionCrossDissolve,
animations: { self.magicButtonImage.image = toImage },
completion: nil)
UIView.animateWithDuration(0.5, animations: {
self.MagicButton.transform =
CGAffineTransformMakeRotation((90.0 * CGFloat(M_PI)) / 180.0)
})
} else {
let toImage = UIImage(named: "close.png")
UIView.transitionWithView(self.magicButtonImage,
duration:0.5,
options: UIViewAnimationOptions.TransitionCrossDissolve,
animations: { self.magicButtonImage.image = toImage },
completion: nil)
UIView.animateWithDuration(0.5, animations: {
self.MagicButton.transform =
CGAffineTransformMakeRotation((0.0 * CGFloat(M_PI)) / 180.0)
})
}
bMagicButtonCloseMode = !bMagicButtonCloseMode
}
Thanks - I know reading code in an email isn't fun.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden