hi guys ... i have a problem with switch view between 2 views with nib files ! here my code . my first page goes to page 2 ! but at page 2 i cant back to first page ! my app go out .. here is my code :
from page 1 to 2 :
#import "HafezViewController.h"
#import "GhazaliateHafez.h"
-(IBAction)gh:(id)sender {
HafezViewController *ghPage = [[HafezViewController alloc] initWithNibName: @"GhazaliateHafez" bundle:nil];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.3];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];
[self.view addSubview:ghPage.view];
[UIView commitAnimations];
}
^^^^^^^^^ this code works great ! but from page 2 to back :
#import "GhazaliateHafez.h"
#import "HafezViewController.h"
@implementation GhazaliateHafez
-(IBAction)ghtoIndex:(id)sender {
HafezViewController *back1 = [[HafezViewController alloc] initWithNibName:@"index" bundle:nil];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.5];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
[self.view addSubview:back1.view];
[UIView commitAnimations];
}
after i tap the back button my app go to crashing ... whats my problem ? thank you