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

Untitled

By: a guest on May 16th, 2012  |  syntax: None  |  size: 1.50 KB  |  hits: 25  |  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. ios: Navigation to another screen using modalTransitionsytle attribute, crashes the app
  2. @interface Navigation : UINavigationController
  3. {
  4. }
  5. -(void)popToMainMenuAnimated:(BOOL)animated;
  6.  
  7. //.m file
  8. -(void)popToMainMenuAnimated:(BOOL)animated
  9. {
  10.     UIViewController *element;
  11.     for(element in self.viewControllers)
  12.     {
  13.         if([element isKindOfClass:[MainSettingClass class]]){
  14.           self.modalTransitionStyle = UIModalTransitionStylePartialCurl;
  15.           [self presentModalViewController:element animated:YES]
  16.         }
  17.      }
  18. }
  19.        
  20. -(void)popToMainMenuAnimated:(BOOL)animated
  21. {
  22.     UIViewController *element;
  23.     for(element in self.viewControllers) {
  24.         if([element isKindOfClass:[MainSettingClass class]]) {
  25.             self.modalTransitionStyle = UIModalTransitionStylePartialCurl;
  26.             [self presentModalViewController:element animated:YES];
  27.             break;
  28.         }
  29.     }
  30. }
  31.        
  32. -(void)loadMainMenuAnimated:(BOOL)animated
  33. {
  34.     MainSettingClass * mainMenuViewController = [[[MainSettingClass alloc] init] autoreleased];
  35.     [mainMenuViewController.view setFrame:CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)];
  36.     // ...
  37.     self.modalTransitionStyle = UIModalTransitionStylePartialCurl;
  38.     [self presentModalViewController:mainMenuViewController animated:YES];
  39. }
  40.        
  41. self.modalTransitionStyle= UIModalTransitionStylePartialCurl;
  42. [self popToViewController:element animated:YES];
  43.        
  44. [self presentModalViewController:yourViewController animated:YES];
  45.        
  46. [self popToViewController:element animated:YES];