Ask a Question related to Mac Programming, Design and Development.
-
Will Oram #1
Object Instances
Another source told me a reason I'm goofing on my program (see 'Absurdly
Easy Cocoa Question') is that I'm not calling instance methods on object
instances. In fact, I didn't create any instances.
BUT...various nib-based program models I'm using for my program don't have
this line:
NSObject *object = [[NSObject alloc] init];
and I assume therefore don't create instances. Yet they use instance methods
and work error and warning free.
For example, Apple's currency converter has no sign of object instances:
[url]http://developer.apple.com/documentation/Cocoa/Conceptual/ObjCTutorial/chapt[/url]
er03/chapter_3_section_7.html
What gives? Thanks.
--
"love is
the search beneath one's spamguy **at** foxchange(.)com
tiny expectations"
Will Oram Guest
-
return object instances
hello, since I'm new to the world of object oriented programming I hope I use the right terms for the concerned things, but I'll try. I was... -
CF7 instances
I wish to create for each subdirectory a new CF7 instance - like this: https://secure.domain.com/my_CF7_instance1/hello.cfm and ... -
Multiple app instances using same shared object.
yeah you can Connect SharedObjects between instances of the same app and even instances of two diffrent apps. you need to use proxied sharedObjects... -
Unwanted mc instances - is it me?
hmm. Just had a look at your movie, and it doesn't look like thats exactly what it does... You have tried starting your levels for swapDepths at... -
Object Instances: Never Mind
Bleh, I'm a twit. After last post but before Mr. Ash's, I figured out my problem. I was referencing a class (ThermCalc is its name), not an outlet... -
Eric Pepke #2
Re: Object Instances
Will Oram <spamguy@ihate.spammers.com> wrote in message news:<BB2E0B61.A8E0%spamguy@ihate.spammers.com>...
Nibs do create instances. However, the way they create them is somewhat different.> Another source told me a reason I'm goofing on my program (see 'Absurdly
> Easy Cocoa Question') is that I'm not calling instance methods on object
> instances. In fact, I didn't create any instances.
>
> BUT...various nib-based program models I'm using for my program don't have
> this line:
>
>
> NSObject *object = [[NSObject alloc] init];
Eric Pepke Guest
-
Will Oram #3
Re: Object Instances
On 7.7.2003 11.21 AM, in article tph-2D90C1.10213407072003@localhost, "Tom
Harrington" <tph@pcisys.no.spam.dammit.net> wrote:
I was admittedly rather vague with my generic code example, so I need to
clarify.
It's not; it's the instantiated class from the nib. I realised I omitted a> Assuming that "Object" is the name of the class,
description of it after I posted -- sorry. Nevertheless the header I've
always been using is effectively similar to your--->
> - (int) calcNewValue:(int)currentValue;It should be. If Object is an instance created from a nib-created class,>>>
>> ** Actually I get three warnings:
>> - the one I mentioned
>> - return type for the method defaults to id (but the variable it returns is
>> an integer!)
> This is the default when no method signature is found; just as C
> defaults to assuming an undeclared function returns int, Obj-C defaults
> to assuming that an undeclared method returns id. The method doesn't
> return int because (as I explained above) it doesn't exist in the form
> that you're trying to call.
then wouldnąt the header I normally use (the one above) work?I was a tad ambiguous last post, so it no doubt confused you. But don't be>
> I think maybe you need to sit down and read up a bit on object-oriented
> programming, and on Cocoa and Objective C.
ready to call me not well-read just yet...that's why I have Cocoa
documentation, an O'Reilly text, various printouts, and Apple's online texts
at close hand at all times when I work. These don't do anything if I don't
try the code! Heck, the only way I learned Carbon was a) Macintosh-C, b)
this newsgroup, and c) toying around.
Thanks.
--
"love is
the search beneath one's spamguy **at** foxchange(.)com
tiny expectations"
Will Oram Guest
-
Will Oram #4
Re: Object Instances
An update now.
I tried the alternative header (for class methods) and it worked. But this
goes against what I asked earlier about nibs and objects, doesn't it?
Quoting you, Mr. Harrington:
"You can create your instances in Interface
Builder, if it's appropriate to the situation."
'Object' in my code, in this case, happens to be an instantiated controller
object. Shouldn't it receive instance, not class, methods then?
Thanks.
--
"love is
the search beneath one's spamguy **at** foxchange(.)com
tiny expectations"
Will Oram Guest
-
Michael Ash #5
Re: Object Instances
In article <BB2FCA95.A938%spamguy@ihate.spammers.com>,
Will Oram <spamguy@ihate.spammers.com> wrote:
Object is also the name of a class in the frameworks. It's old, and kept> 'Object' in my code, in this case, happens to be an instantiated controller
> object. Shouldn't it receive instance, not class, methods then?
around mostly for compatability reasons, but it's there. Change the name
of your variable. Apparently the class's name takes precedence over your
variable's name.
The general convention is to make your class names begin with an
uppercase letter and make your variables begin with a lowercase letter.
If you do that you'll avoid this problem.
Michael Ash Guest
-
John C. Randolph #6
Re: Object Instances
Mark Haase wrote:
Close, but not quite.>
> In article <BB2E1474.A908%spamguy@ihate.spammers.com>,
> Will Oram <spamguy@ihate.spammers.com> wrote:
>>> > I get a warning claiming it can't find the class (factory) method?** I was
> > unsure which object to use in 'Object''s place...I expected it to be the
> > object that contains the method's header and body. Instead, I get this
> > warning no matter *what* object I insert there.
> A factory method is a method that returns an a new instance of an
> object, but isn't a constructor. The Cocoa API has lots of these. Look
> at all the class methods for NSString (they are marked with +'s).
In Obj-C parlance, a "factory" method is any class method. Not all
factory methods create instances. Methods that create objects are
+alloc, -copy, and what we refer to as "convenience methods", such as
+stringWithFormat: or -stringByAppendingString:.
-jcr
John C. Randolph Guest



Reply With Quote

