Show Modal Dialog


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. -(IBAction)buttonClick:(id)sender
  2. {
  3.  
  4. PurchaseWindowViewController* viewController = [[PurchaseWindowViewController alloc] initWithNibName:@"PurchaseWindowViewController" bundle:nil];
  5.  
  6. UINavigationController *navController = [[UINavigationController alloc]
  7. initWithRootViewController:viewController];
  8.  
  9.  
  10. navController.modalPresentationStyle = UIModalPresentationFormSheet;
  11. navController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
  12.  
  13. viewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel", @"") style:UIBarButtonItemStyleBordered target:self action:@selector(close)];
  14.  
  15. [self presentModalViewController:navController animated:YES];
  16.  
  17. //targetController.view.superview.frame = CGRectMake(0, 0, 200, 200);//it's important to do this after presentModalViewController
  18. //targetController.view.superview.center = self.view.center;
  19.  
  20. // Clean up resources
  21. [navController release];
  22. [viewController release];
  23.  
  24. }
  25.  
  26.  
  27. - (void)close
  28. {
  29. [self dismissModalViewControllerAnimated:YES];
  30. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.