I am new with Objective-C so apologies for a dumb question.
I am opening an "options" view controller from my main view controller. Both are built in the storyboard. Before and after presenting the options controller I need to stop and start a timer on my main view controller. After the options controller is closed (a button calls dismiss) I need to send some info back to my main controller or at least let my main controller know that it needs to refresh some values.
MAIN QUESTION What's the best way of presenting a view controller and executing some presenter's methods before and after opening?
WHAT I'VE TRIED I found a few ways to do it, but they are all cumbersome and I assume that there must be some plausible way of doing it.
- Ideally I'd like to use the segue I set up in the storyboard between the two controllers.
- I managed to call the options controller programmatically by accessing the storyboard and calling instantiateViewControllerWithIdentifier. It worked but looks a bit complex.
- I was not able to find a delegate method on the UIViewController to handle the dismiss event
- When I was trying to access the main controller in the options controller via presentingViewController and downcasting it, I got a linkage error by including my .h file twice (not sure what are the Obj-C standards of using #define).
Appreciate your help...