i am using the following code to flip between two UIViews..
- (IBAction)switchView:(id)sender
{
UIView *mainView =View1.view;
UIView *flipsideView =View2.view;
[UIView beginAnimations:@"View" context:nil];
[UIView setAnimationDuration:1.00];
[UIView setAnimationTransition: UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
if([mainView superview] !=nil)
{
[View2 viewWillAppear:YES];
[View1 viewWillDisappear:YES];
[mainView removeFromSuperview];
[self.view addSubview:flipsideView];
}
else
{
[View1 viewWillAppear:YES];
[View2 viewWillDisappear:YES];
[flipsideView removeFromSuperview];
[self.view addSubview:mainView];
}
[UIView commitAnimations];
}
View2 is a different xib file but still when i use the code same View1 appears after flipping..what am i doing wrong in here??