Re: Outlet from Different Implementation?
Re: Outlet from Different Implementation?
- Subject: Re: Outlet from Different Implementation?
- From: Graham Cox <email@hidden>
- Date: Wed, 17 Sep 2008 12:11:00 +1000
On 17 Sep 2008, at 11:18 am, Jeshua Lacock wrote:
- (id) myOutlet
{
return MyOutlet;
}
Thanks Graham,
Looks simple enough, however, I can't seem to make it work.
I get a warning "warning: instance variable 'MyOutlet' accessed in a
class method"
Does your accessor look like mine above, or does it look like this:
+ (id) myOutlet
{
return MyOutlet;
}
The '+' or '-' symbol in front of the method is very important. +
means it's a class method, - means it's an instance method. See here:
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_3_section_3.html#/
/apple_ref/doc/uid/TP30001163-CH12-TPXREF122
In the other implementation that I am attempting to get the value of
MyOutlet from, I am calling your suggested MyOutlet accessor method
with:
id MyOutletID = [MyContent MyOutlet];
It occurs to me that you have written it correctly as an instance
method, but are trying to access it as a class method, so:
foo = [MyClass myOutlet]; would be wrong. You need to have an actual
reference to an instance of the class, e.g. foo =
[someObjectOfInterest myOutlet]; where someObjectOdInterest is
declared as MyContent* someObjectOfInterest; and of course has been
assigned, either using IB or using alloc/init in code.
It's hard to know how best to address your question in this case - it
suggests a bit of a misunderstanding about what objects and classes
are, so maybe you just need to brush up on OO in general?
hth,
Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden