Reputation: 614
I want to show and hide the animation gif file when button is pressed in the home page. Please if there a way like this let me know.
how to use curl up and curl down in the above question.
Upvotes: 0
Views: 695
Reputation: 162
use this code inside button action ,in this code viewcontroller is removed, and the "home" viewcontroller is added, with a pageflip like transition
[UIView beginAnimations:@"Flip" context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.base.view cache:YES];
[user.view removeFromSuperview];
[base.view addSubview:home.view];
[UIView commitAnimations];
Upvotes: 0
Reputation: 594
You can use UIAnimation block, initially set the UIImageView frame to (0,480,320,480). So that it will be out of screen i.e it won't be visible then on button click change the Y coordinate to zero using animation block.
[UIView animateWithDuration:0.5
delay:1.0
options: UIViewAnimationCurveEaseOut
animations:^{
self.yourImageView.frame = CGRectMake(0,0,320,480);
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
Upvotes: -1
Reputation: 1472
Here's a suggestion. Instead of using a UIImageView
, use another UIViewController
.
From your main UIViewController
, create a Modal Segue
to another UIViewController
.
In the attributes inspector of your segue
- set the animation to Partial Curl.
In that UIViewController
, add your UIImageView with the GIF file - and a back button to dismiss the modal view controller.
Upvotes: 2