Suppose your child has a bowl of ice cream, and wants a cherry on top. You go to the freezer and get out the ice cream carton. You get a bowl out of the cabinet. You put some ice cream in the bowl. Now you have a bowl of ice cream. You get a cherry out of the refrigerator and put a cherry on it. Then you throw the bowl of ice cream (with cherry on top) away. Now you're confused, because your child's bowl of ice cream still has no cherry on top! What did you do wrong?
This scenario is a metaphor for your problem. You need to send the setTitleVersion:
message to your existing instance of MyMain
. You can't just create an entirely new instance of MyMain
, send the message to it, and then throw away that new instance.
Your comment on rdelmar
's answer says that your existing instance of MyMain
is in your main nib, and you have an outlet to it. I assume that means you have an outlet of type MyMain
on your MyAppDelegate
, and that the outlet is hooked up to a MyMain
object in your nib. In that case, you want to send the setTitleVersion:
message to the object in the outlet. If your outlet were named mainObject
, you would do it like this:
[self.mainObject setTitleVersion:version];
If you haven't created an outlet in MyAppDelegate
yet, you can create it and hook it up in one step using Xcode's assistant editor. Open the assistant editor and make sure it is showing MyAppDelegate.h
. Then control-drag from the MyMain
object in the nib into your @interface MyAppDelegate
, like this:
If you already have an outlet declared in your MyAppDelegate
, you can connect it in the nib editor. Control-click on the My App Delegate
placeholder in the nib's Objects list. Then, in the outlets pop-up, drag from the outlet's circle to the MyMain
object placeholder, like this: