Re: Accessing instance method in nib
Re: Accessing instance method in nib
- Subject: Re: Accessing instance method in nib
- From: Charilaos Skiadas <email@hidden>
- Date: Wed, 27 Jul 2005 15:45:37 -0500
On Jul 27, 2005, at 2:11 PM, Chen Wang wrote:
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;
You probably meant to write:
- (NSString*) Foo: (NSString*)theString;
Notice the colon. In that case, how are you calling Foo? Supposing
outletB is the name of the outlet that A has connecting it to B, and
the following code is within some method of objA, the following
should work:
result = [outletB Foo:someString];
If not, then you better tell us what the exact compiler warning/error
you are getting is.
Oh, of course you should also include in class A , at the top, a line
like:
#include "classB.h"
or at the very least
@class classB;
So that the compiler knows about it.
Not knowing anything about mixing Obj-C with Obj-C++, I'll stay clear
of the second part of your email. But if all these are Obj-C classes,
then it should have nothing to do with it.
Haris
_______________________________________________
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