Skip to content

Instantly share code, notes, and snippets.

@arielelkin
Created June 26, 2012 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arielelkin/2996796 to your computer and use it in GitHub Desktop.
Save arielelkin/2996796 to your computer and use it in GitHub Desktop.
Navigation with a huge memory footpring
@implementation CBNavigator
int currentPage = -1;
-(void)viewDidAppear:(BOOL)animated{
NSLog(@"Navigator appeared");
if(currentPage == -1){
currentPage++;
UIViewController *nextPageVC = [self.storyboard instantiateViewControllerWithIdentifier:[NSString stringWithFormat:@"%d", currentPage ]];
[self presentModalViewController:nextPageVC animated:YES];
[nextPageVC.view addSubview:self.view];
}
}
-(IBAction)goToNextPage{
[self dismissViewControllerAnimated:YES completion:^{
NSLog(@"dismissed!");
currentPage++;
UIViewController *nextPageVC = [self.storyboard instantiateViewControllerWithIdentifier:[NSString stringWithFormat:@"%d", currentPage ]];
[self presentModalViewController:nextPageVC animated:YES];
[nextPageVC.view addSubview:self.view];
NSLog(@"Current Page is %d", currentPage);
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment