在presentModalViewController之后等待 [英] wait after presentModalViewController
问题描述
我需要在presentModalViewController之后等待(不执行代码),直到其被取消的模态视图,可能还是概念错误?
I need to wait (don't execute the code) after the presentModalViewController until the modal view it's dismissed, it's possible or it's 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's 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;
}
推荐答案
您需要做的是创建一个 LoginRegViewControllerDelegate
协议,呈现模态视图控制器的视图控制器将遵守该协议,并且让您的 LoginRegViewController
(或其他名称)向其 delegate
发送一条消息,表明它刚刚关闭/即将关闭.在这种委托方法中,您的委托View Controller应该读取刚刚设置的设置,并对其进行任何操作.
What you'll have to do is create a LoginRegViewControllerDelegate
protocol to which the View Controller that presents the Modal View Controller adheres, and have your LoginRegViewController
(or whatever its name is) send a message to its delegate
that it just closed / is going to close. In this delegate method, your delegate View Controller should read the just-set settings and do whatever it wants with them.
这篇关于在presentModalViewController之后等待的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!