How to make dissolve animation on changing views in iphone?
Dissolve effect: one view is changing another without any movement.
Thanks a lot for the help!
You can also use UIViewAnimationOptionTransitionCrossDissolve in ios5 and later...
[UIView transitionFromView:currentView
toView:nextView
duration:2
options:UIViewAnimationOptionTransitionCrossDissolve
completion:^(BOOL finished) {
[currentView removeFromSuperview];
}];
The animation you're looking for is:
[UIView animateWithDuration: 1.0
animations:^{
view1.alpha = 0.0;
view2.alpha = 1.0;
}];
A more complete solution, using that animation might be:
- (void) replaceView: (UIView *) currentView withView: (UIView *) newView
{
newView.alpha = 0.0;
[self.view addSubview: newView];
[UIView animateWithDuration: 1.0
animations:^{
currentView.alpha = 0.0;
newView.alpha = 1.0;
}
completion:^(BOOL finished) {
[currentView removeFromSuperview];
}];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With