Friday, February 25, 2011

Multiple View Navigate Example

//In that case hearder file looks like..
#import [UIKit/UIKit.h]


@interface UIRegisterAccount : UIViewController {

IBOutlet UIView *view2;
IBOutlet UIView *view3;
}

-(IBAction) NextTouch:(id)sender;
-(IBAction) NextTouchUserDetail:(id)sender;
-(IBAction) BackTouchUserDetail:(id)sender;
-(IBAction) BackTouchCreditCard:(id)sender;
-(void)AnimationEnded;
-(void)AnimationEnded2;

@end

//In mail file
-(IBAction) NextTouch:(id)sender
{
[self.view addSubview:view2];
[view2 setFrame:CGRectMake(320, 0, 0, 460)];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[view2 setFrame:CGRectMake(0, 0, 320, 460)];
[UIView commitAnimations];
}
-(IBAction) NextTouchUserDetail:(id)sender
{
[self.view addSubview:view3];
[view3 setFrame:CGRectMake(640, 0, 0, 460)];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[view3 setFrame:CGRectMake(0, 0, 320, 460)];
[UIView commitAnimations];

}
-(IBAction) BackTouchUserDetail:(id)sender
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.5];
[view2 setFrame:CGRectMake(640, 0, 0, 460)];
[UIView setAnimationDidStopSelector:@selector(AnimationEnded)];
[UIView commitAnimations];
}

-(IBAction) BackTouchCreditCard:(id)sender
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.5];
[view3 setFrame:CGRectMake(640, 0, 0, 460)];
[UIView setAnimationDidStopSelector:@selector(AnimationEnded2)];
[UIView commitAnimations];

}
-(void)AnimationEnded
{
[view2 removeFromSuperview];
}
-(void)AnimationEnded2
{
[view3 removeFromSuperview];
}

No comments:

Post a Comment