Thursday 19 December 2013

Curl up and down a UIView with animation example in iPhone

This examples shows how to Curl Up a UIView with animation effect. 

Code for .h file.
#import 

@interface FirstViewController : UIViewController {

    IBOutlet UIView *viewSecond;
    IBOutlet UIView *viewFirst;  
 
}

- (IBAction)btnSecondView_Clicked:(id)sender;
- (IBAction)btnFirstView_Clicked:(id)sender;

@end

Code for .m file.

#import "FirstViewController.h"

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)btnSecondView_Clicked:(id)sender {

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:2.0];
    [viewSecond setAlpha:0.0];
    [viewFirst setAlpha:1.0];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:viewSecond cache:YES];
    [UIView commitAnimations];  
 
}

- (IBAction)btnFirstView_Clicked:(id)sender {

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:2.0];
    [viewFirst setAlpha:0.0];  
 
    [viewSecond setAlpha:1.0];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:viewFirst cache:YES];
    [UIView commitAnimations];
}
  
 
- (void)didReceiveMemoryWarning {
  
 
    [super didReceiveMemoryWarning];
  
 
}


- (void)dealloc {
    [super dealloc];
}


@end

No comments:

Post a Comment

Comment