当视图获得焦点时应该调用方法

发布于 2024-12-15 12:56:28 字数 364 浏览 0 评论 0原文

在我的 iOS 项目中,我使用 InAppSettings。这是在模态视图控制器中缺少委托willDismiss。

因此,当模态视图被关闭时,我希望在主视图控制器中调用一个方法。我该怎么做?视图控制器中是否有一个方法在视图再次获得焦点时被触发?

in my iOS project I use InAppSettings. This is missing a delegate in the modal view controller for willDismiss.

So when the modal view gets dismissed I want a method to be called in my main view controller. How can I do this? Is there a method in a view controller that gets triggered whe the view is in focus again?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暮凉 2024-12-22 12:56:28

你可以尝试这样的事情

BOOL settingsLaunched = NO;

-(void)presentInAppSettingsViewController
{
    //Show the settings modal view controller here

    //Set our flag
    settingsLaunched = YES;
}

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    if(settingsLaunched)
    {
        //Your code here
    }
}

You could try something like this

BOOL settingsLaunched = NO;

-(void)presentInAppSettingsViewController
{
    //Show the settings modal view controller here

    //Set our flag
    settingsLaunched = YES;
}

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    if(settingsLaunched)
    {
        //Your code here
    }
}
安稳善良 2024-12-22 12:56:28

在关闭它呈现的模式对话框后,这些将在视图上被调用

- (void) viewWillAppear
- (void) viewDidAppear:(BOOL)animated

these will get called on the view after dismissing a modal dialog it presents

- (void) viewWillAppear
- (void) viewDidAppear:(BOOL)animated
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文