Wait After PresentModalViewController
I need to wait (not execute code) after the currentModalViewController until the modal view is rejected, is this possible or a conceptual error?
-(NSDictionary *)authRequired
{
//This view write the settings when dismissed (plist)
[self presentModalViewController:loginRegView animated:YES];
//Read from the setting file (plist) and send back (it a delagate method)
NSMutableDictionary *ret=[[NSMutableDictionary alloc] init];
[ret setObject:[app.settings get:@"user"] forKey:@"user"];
[ret setObject:[app.settings get:@"pass"] forKey:@"pass"];
return ret;
}
a source to share
What you need to do is create a protocol LoginRegViewControllerDelegate
that the view controller is attached to, representing the Modal View Control, and your LoginRegViewController
(or his name) will send a message to it delegate
that it just closes / closes. In this delegate method, your delegate view manager should read the settings you just configured and do whatever it wants with them.
a source to share
To make your view controller (modal view) more flexible and reusable you can use NSNotificationCenter
. Here's a link to the class.
Your modal view should have a notification that it will be closed. Any other controller that needs to respond to this notification must add the observer to the same notification center.
a source to share