Accessing instance method in nib
Accessing instance method in nib
- Subject: Accessing instance method in nib
- From: "Chen Wang" <email@hidden>
- Date: Wed, 27 Jul 2005 15:11:29 -0400
- Thread-topic: Accessing instance method in nib
Dear List,
Does anyone know how to access an obj's instance method in nib?
Assuming that classA and classB are all subclasses of NSObject, and are
respectively instantiated as objA and objB in the same nib with IB. objB
is hooked on objA's IBOutlet, so that objA can access objB. Everything
goes fine so far, but the problem is: when objA tries to access objB's
method (Foo), the compiler report that no - Foo methos is found.
The method Foo is not an IBAction, it is defined in classB like
following:
- (NSString*) Foo (NSString*)theString;
I know it sounds like a quite basic question, but I hope this could be a
work round to another problem that I'm struggling with. Please allow me
to explain more about the background problem:
classA is a pure objC class in .m file
classB is an objC++ class in .mm file with a lot of .cpp files included
in its header
The question is how to access classB (objB) from classA (objA) ? I know
it is very easy if both of them are coded in the same language, but
unfortunately, they are now in different languages. I could not include
a .mm file in a .m file (of course I can, but the compiler will not
recognize C++ codes in the .mm header file). I also don't like the
"solution" switching classA's file extension from .m to .mm, because
this kind of switching will spread quickly along the inherit chain
across the whole project, resulting the final application paying too
much performance for just a small piece of C++ codes.
To avoid including a .mm file in a .m file, I came up with a possible
work round: instantiate the two classes in the same nib, and let them
getting to know each other without having to including one into anther.
That's why I'm asking the first question here.
Thank you very much in advance!
Chen
Confidentiality Notice: This e-mail, including any attachments, is for the sole use of the intended recipient(s) and may contain private, confidential, and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient or this information has been inappropriately forwarded to you, please contact the sender by reply e-mail and destroy all copies of the original.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden