Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 30th, 2012  |  syntax: None  |  size: 1.18 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ModalViewController with embedded nav controller - Unable to dismiss
  2. // Make a navigation controller and add the view inside it
  3.     MyViewController *evc=[[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
  4.     //UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:evc];
  5.     UINib *nib = [UINib nibWithNibName:@"UINavigationBarWithBackgroundImage" bundle:nil];
  6.     UINavigationController *nvc = [[nib instantiateWithOwner:nil options:nil] objectAtIndex:0];
  7.     [nvc setViewControllers:[NSArray arrayWithObject:evc]];
  8.     evc.delegate=self;
  9.     [evc release];
  10.     [self presentModalViewController:nvc animated:YES];
  11.     [nvc release];
  12.        
  13. [self dismissModalViewControllerAnimated:YES];
  14.        
  15. [nvc release]
  16.        
  17. [self dismissModalViewControllerAnimated:YES];
  18.        
  19. // Make a navigation controller and add the view inside it
  20. MyViewController *evc= [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
  21.  
  22. UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:evc];
  23.  
  24. evc.delegate=self;
  25.  
  26. [self presentModalViewController:navController animated:YES];
  27.  
  28. [evc release];
  29. [navController release];