Method should be called when a view gets into focus
-
28-02-2021 - |
Question
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
}
}
OTHER TIPS
these will get called on the view after dismissing a modal dialog it presents
- (void) viewWillAppear
- (void) viewDidAppear:(BOOL)animated
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow