• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is it possible to call events in other .m classes?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is it possible to call events in other .m classes?


  • Subject: Re: Is it possible to call events in other .m classes?
  • From: Simon Wilson <email@hidden>
  • Date: Tue, 27 Jan 2009 17:54:38 +0100

Hi Arnaud,

> I have to call a method in the instance of ApplicationController and I don't know how to do that.

You can obtain a reference to your application's delegate from anywhere in the application using:

[NSApp delegate]

Sending it a message should be as simple as:

[[NSApp delegate] doSomethingWith:thisObject];

Simon
http://www.zennaware.com

On Jan 27, 2009, at 16:22 PM, Arnaud Nicolet wrote:

Hello,

My configuration is somehow special: I have a Main_TestPref class and a ApplicationController class. The Main_TestPref class receives system events, like "mainViewDidLoad" when the interface is shown. The ApplicationController is the class whose outlets and actions are linked to (I couldn't link to the Main_TestPref class because Interface Builder don't know it exists).

When the application starts, I get the "mainViewDidLoad" in the Main_TestPref class. It's where I should update my controls to show saved values (read from a prefs file). My problem is that the class that knows my controls/outlets is the ApplicationController class, not the Main_TestPref class. So, in the "mainViewDidLoad" method of the Main_TestPref, I have to call a method in the instance of ApplicationController and I don't know how to do that.

I know it seems bad design but I think I haven't another choice.

I'm looking for some help, please.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Is it possible to call events in other .m classes? (From: Arnaud Nicolet <email@hidden>)

  • Prev by Date: Re: are static operations optimized?
  • Next by Date: Re: are static operations optimized?
  • Previous by thread: Is it possible to call events in other .m classes?
  • Next by thread: Re: Is it possible to call events in other .m classes?
  • Index(es):
    • Date
    • Thread