/ Published in: iPhone
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//declare the protocol @protocol ModalViewControllerDelegate<NSObject> - (void) didFinishModalView: (ModalViewController*) aModalViewController; @end //declare a delegate property @interface ModalViewController : UIViewController { } @property (nonatomic, assign) id<ModalViewControllerDelegate> delegate; @end // [delegate didFinishModalView: self]; //////////////////// //make the view controller confort to the protocol <ModalViewControllerDelegate> //initiate modal view and present it ModalViewController *myModalViewController = [[MyViewController alloc] initWithNibName: @"ModalViewController" bundle: [NSBundle mainBundle]]; myModalViewController.delegate = self; [self presentModalViewController: myModalViewController animated: YES]; //dismiss the modal view - (void) didFinishModalView: (ModalViewControllerDelegate*) aModalViewControllerDelegate { [self dismissModalViewControllerAnimated: YES]; }