Search code examples
objective-cinappsettings

Method should be called when a view gets into focus


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?


Solution

  • 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
        }
    }