I have 2 UIViewControllers in a UITabBar and would like to create a facade for one of my UIViewControllers, and am running into issues when trying to do this:
//within the 2nd view controller, that has not been displayed yet:
-(void)startApp
{
locationManager.delegate = self;
[locationManager startUpdatingLocation];
}
I’m trying
//within the first view controller:
[delegate startApp]
What does “self” refer to in the example above? If I set a breakpoint, I see that the callback within the 2nd view controller gets called, but it does not produce the same effect as when I call it from the 2nd view controller directly.
The ViewDidLoad within the 2nd view controller does not get called until I tap on that controller, but still, even if I do so, and then call the startApp method, the result is still unexpected.
It is very possible that I broke the MVC model with my setup, and will have to pull out pieces of code and create an underlying model that both controllers would be using, but I was hoping for a quick and dirty solution.
Thank you for any clarifications!
startApp is an instance method on “2nd View Controller”, so ‘self’ refers to the particular instance of your “2nd View Controller” that received this message.