I want to be able to send a message from my mkmapview delegate class to one of my view controllers. I normally send messages by allocating/initing a new instance of that class, but this time I’m trying to send a message to an instance that’s already there.
What are the various ways I can do this? Is there a preferred way?
Edit:
I found my solution. Not sure if it’s the best way, but it’s certainly the easiest as far as I can see and perfect for what I need.
What I did was have a static myViewController variable inside my viewController, then have it be set to self in my viewDidLoad. Last, I added a static method to get the static variable.
Either I don’t understand what you are asking, or it is quite simple. You should have a reference to the instance (say it is called
myInstance), and then you can simply send a message like:Of course you should only send messages the receiver (myInstance) can understand. Which they are, depends on the class of the receiver, and on any categories that are defined for its class and in scope.