I am using the following method to switch views:
FirstView.m
-(IBAction)showAnimal:(UIButton *)sender{
NSString *digit = [NSString stringWithFormat:@"%d",[sender tag]];
//NSString *digit = [[sender titleLabel] text];
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
appDelegate.indexOfImage = digit;
Animal *myAnimal = [[Animal alloc]
initWithNibName:@"Animal" bundle:nil];
[UIView beginAnimations:@"flipView" context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
forView:self.view cache:YES];
[UIView commitAnimations];
//[self presentModalViewController:myAnimal animated:YES];
myAnimal.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
[self.view addSubview:myAnimal.view];
self.view.bounds = myAnimal.view.bounds;
}
Method on Second View Animal.m
-(IBAction)backToFront:(id)sender{
[UIView beginAnimations:@"flipView" context:nil];
[UIView setAnimationDuration:1.2];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown
forView:self.view.superview cache:YES];
[self.view removeFromSuperview];
[UIView commitAnimations];
}
I used this code several times and it always worked without any problems, until now. My app is crushing every time when I want to switch back. So the method on the Animal view crashes. The weird thing is that I get an odd error. I got a screenshot of that.
Please help!